A
AlphaRedDragon
Guest
so i am working on a game where one of the bosses is meant to jump above you and fall and crush blocks below him, kinda like one of the mario boss fights,will post image link. but when i run the game he always hovers at the top and when he falls, he breaks a block and goes back to the top, basically the oppisate of what he is supposed to do. i will post the code below, thank you for your help
http://mariowiki.jixun.org/images/0/0a/1st_ground_pound.PNG
(what he is supposed to do)
vatiable global.falling_earth is to detect when he is falling to crush a block.
(step Event Code)
cooldown -=1
if(cooldown <=0)
{
cooled = 0
jumped = 1
}
if(jumped = 1)
{
if(obj_player.x < obj_earth_boss.x)
{
global.jump_dir = -1
}
else
{
global.jump_dir = 1
}
if(global.falling_earth = 0)
{
if(global.jump_dir = -1)
{
vsp = -10
hsp = -8
}
if(global.jump_dir = 1)
{
vsp = -10
hsp = 8
}
}
if(obj_earth_boss.x = obj_player.x)
{
global.falling_earth = 1;
}
if(global.falling_earth = 1)
{
vsp = 25
hsp = 0
}
}
if(vsp <= 10)
{
vsp += grav
}
if(jumped =0)
{
if(cooled = 0)
{
cooled = 1;
cooldown = 300;
}
}
// horizantal collission
if (place_meeting(x+hsp,y,obj_collide))
{
while(!place_meeting(x+sign(hsp),y,obj_collide))
{
x += sign(hsp);
}
hsp = 0;
}
//vert collision
if (place_meeting(x,y+vsp,obj_collide))
{
while(!place_meeting(x,y+sign(vsp),obj_collide))
{
y += sign(vsp);
}
vsp = 0;
jumped = 0;
}
x+= hsp
y+= vsp
http://mariowiki.jixun.org/images/0/0a/1st_ground_pound.PNG
(what he is supposed to do)
vatiable global.falling_earth is to detect when he is falling to crush a block.
(step Event Code)
cooldown -=1
if(cooldown <=0)
{
cooled = 0
jumped = 1
}
if(jumped = 1)
{
if(obj_player.x < obj_earth_boss.x)
{
global.jump_dir = -1
}
else
{
global.jump_dir = 1
}
if(global.falling_earth = 0)
{
if(global.jump_dir = -1)
{
vsp = -10
hsp = -8
}
if(global.jump_dir = 1)
{
vsp = -10
hsp = 8
}
}
if(obj_earth_boss.x = obj_player.x)
{
global.falling_earth = 1;
}
if(global.falling_earth = 1)
{
vsp = 25
hsp = 0
}
}
if(vsp <= 10)
{
vsp += grav
}
if(jumped =0)
{
if(cooled = 0)
{
cooled = 1;
cooldown = 300;
}
}
// horizantal collission
if (place_meeting(x+hsp,y,obj_collide))
{
while(!place_meeting(x+sign(hsp),y,obj_collide))
{
x += sign(hsp);
}
hsp = 0;
}
//vert collision
if (place_meeting(x,y+vsp,obj_collide))
{
while(!place_meeting(x,y+sign(vsp),obj_collide))
{
y += sign(vsp);
}
vsp = 0;
jumped = 0;
}
x+= hsp
y+= vsp