Add project code

This commit is contained in:
Andrew Trieu
2025-04-20 15:57:23 +03:00
committed by Andrew Trieu
commit 3fbd0e4977
612 changed files with 11196 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
event_inherited();
bullet_dir = 0;
bullet_spd = 4;
start_x = x;
start_y = y;
is_exploding = false;
max_distance = 500;
s_destroy = s_arrow_destroy;
pass_through_enemy = false;
state = 0;

View File

@@ -0,0 +1,3 @@
if sprite_index == s_destroy {
instance_destroy();
}

View File

@@ -0,0 +1,44 @@
if pause_movement() { exit; }
switch(state) {
case 0:
if instance_exists(o_player) {
bullet_dir = point_direction(x, y, o_player.x, o_player.y);
}
depth = -y - 50;
break;
case 1:
if (!is_exploding) {
// Calculate movement
var bullet_x_spd = lengthdir_x(bullet_spd, bullet_dir);
var bullet_y_spd = lengthdir_y(bullet_spd, bullet_dir);
// Move the fireball
x += bullet_x_spd;
y += bullet_y_spd;
depth = -y;
if hit_confirmed && !pass_through_enemy {
destroy_projectile()
}
// Check for collision with solid wall
if place_meeting(x, y, o_solid_wall) {
destroy_projectile();
}
// Check if fireball has traveled too far
if point_distance(start_x, start_y, x, y) > max_distance {
destroy_projectile();
}
if bbox_right < 0 || bbox_left > room_width || bbox_bottom < 0 || bbox_top > room_height {
destroy_projectile();
}
}
break;
}

43
objects/o_arrow/o_arrow.yy generated Normal file
View File

@@ -0,0 +1,43 @@
{
"$GMObject":"",
"%Name":"o_arrow",
"eventList":[
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":7,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
],
"managed":true,
"name":"o_arrow",
"overriddenProperties":[],
"parent":{
"name":"Enemies",
"path":"folders/Enemies.yy",
},
"parentObjectId":{
"name":"o_player_hurt",
"path":"objects/o_player_hurt/o_player_hurt.yy",
},
"persistent":false,
"physicsAngularDamping":0.1,
"physicsDensity":0.5,
"physicsFriction":0.2,
"physicsGroup":1,
"physicsKinematic":false,
"physicsLinearDamping":0.1,
"physicsObject":false,
"physicsRestitution":0.1,
"physicsSensor":false,
"physicsShape":1,
"physicsShapePoints":[],
"physicsStartAwake":true,
"properties":[],
"resourceType":"GMObject",
"resourceVersion":"2.0",
"solid":false,
"spriteId":{
"name":"s_arrow",
"path":"sprites/s_arrow/s_arrow.yy",
},
"spriteMaskId":null,
"visible":true,
}