Add project code
This commit is contained in:
12
objects/o_fireball/Create_0.gml
Normal file
12
objects/o_fireball/Create_0.gml
Normal file
@@ -0,0 +1,12 @@
|
||||
event_inherited();
|
||||
|
||||
bullet_dir = 0;
|
||||
bullet_spd = 5;
|
||||
bullet_x_spd = 0;
|
||||
bullet_y_spd = 0;
|
||||
is_exploding = false;
|
||||
start_x = x;
|
||||
start_y = y;
|
||||
max_distance = 300;
|
||||
s_destroy = s_fireball_destroy;
|
||||
pass_through_enemy = false;
|
||||
3
objects/o_fireball/Other_7.gml
Normal file
3
objects/o_fireball/Other_7.gml
Normal file
@@ -0,0 +1,3 @@
|
||||
if sprite_index == s_destroy {
|
||||
instance_destroy();
|
||||
}
|
||||
28
objects/o_fireball/Step_0.gml
Normal file
28
objects/o_fireball/Step_0.gml
Normal file
@@ -0,0 +1,28 @@
|
||||
if pause_movement() { exit; }
|
||||
|
||||
// Movements
|
||||
#region
|
||||
if (!is_exploding) {
|
||||
// Calculate movement
|
||||
var x_speed = lengthdir_x(bullet_spd, bullet_dir);
|
||||
var y_speed = lengthdir_y(bullet_spd, bullet_dir);
|
||||
|
||||
// Move the fireball
|
||||
x += x_speed;
|
||||
y += y_speed;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
43
objects/o_fireball/o_fireball.yy
generated
Normal file
43
objects/o_fireball/o_fireball.yy
generated
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$GMObject":"",
|
||||
"%Name":"o_fireball",
|
||||
"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_fireball",
|
||||
"overriddenProperties":[],
|
||||
"parent":{
|
||||
"name":"Spells",
|
||||
"path":"folders/Spells.yy",
|
||||
},
|
||||
"parentObjectId":{
|
||||
"name":"o_enemy_hurt",
|
||||
"path":"objects/o_enemy_hurt/o_enemy_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_fireball",
|
||||
"path":"sprites/s_fireball/s_fireball.yy",
|
||||
},
|
||||
"spriteMaskId":null,
|
||||
"visible":true,
|
||||
}
|
||||
Reference in New Issue
Block a user