CryptidProductions
Member
I have this issue where if I jump up to a higher platform while my code has the variable for the attack cycle set to true the entire game hard locks as soon as she hits the floor block, but only when landing on a higher platform. No error or crash, just a complete freeze where the game can't even be exited out.
Footage:
Code for movement/controls and gravity. The Alarm[0] just sets the casting back to false when it goes off to create a firing delay, momentarily pausing movement, and allowing for some sprite changing when attacking when reverts afterward
Footage:
Code for movement/controls and gravity. The Alarm[0] just sets the casting back to false when it goes off to create a firing delay, momentarily pausing movement, and allowing for some sprite changing when attacking when reverts afterward
GML:
///Movement and sprites
//Read Keyboard
if casting = false {
if keyboard_check (vk_right) {
hspd = 5;
image_speed = 0.2;
sprite_index = Sarah_Right_Spr;
dir = 1;
}
if keyboard_check (vk_left) {
hspd = -5;
image_speed = 0.2;
sprite_index = Sarah_Left_Spr;
dir = -1;
}
if keyboard_check (vk_nokey) {
hspd = 0;
image_speed = 0;
}
if keyboard_check_pressed (vk_space) and place_meeting (x, y+1, wall_block_obj) {
vspd = -10;
vdir = -1;
}
if vspd > -1 {
vdir = 1;
}
}
//cast spell
if keyboard_check_pressed (vk_alt) and casting = false {
if dir = 1{
sprite_index = Sarah_Casting_Spr
image_speed = 0
image_index = 1
instance_create (x+50, y+30, Player_Bullet);}
if dir = -1{
sprite_index = Sarah_Casting_Spr
image_speed = 0;
image_index = 2
instance_create (x+8, y+30, Player_Bullet);}
casting = true;
alarm[0] = room_speed*0.5;
}
//Gravity and Collisons
if vspd < 5 {
vspd += grav;
}
//vertical move andstop
if place_meeting (x, y+vspd, wall_block_obj) {
while !place_meeting (x, y+sign(vdir), wall_block_obj) {
y += sign(vdir)
}
vspd = 0;
}
y += vspd;
//horizontal move and stop
if place_meeting (x+hspd, y, wall_block_obj) {
while !place_meeting (x+sign(dir), y, wall_block_obj) {
x += sign(dir)
}
hspd = 0;
}
x += hspd;