F
fxokz
Guest
In my game if an enemy is close enough to you it will go into its chase state in which it moves in your direction.
I want to add a system so that if there is an obstacle in the way OR if there isnt a platform in front it will attempt to jump over the gap. The problem is how can i program the ai so that it can know if there is a platorm where it can jump.. Otherwise it just jumps off a cliff and dies :/
Right now when the enemy ai jumps it just keeps flying in the air off the screen..
also if there is a box in front of the enemy, how can i make it know if its jumpable or not.
I want to add a system so that if there is an obstacle in the way OR if there isnt a platform in front it will attempt to jump over the gap. The problem is how can i program the ai so that it can know if there is a platorm where it can jump.. Otherwise it just jumps off a cliff and dies :/
Right now when the enemy ai jumps it just keeps flying in the air off the screen..
Code:
// enemy collision
if (place_meeting(round(x+hsp),round(y),obj_block))
{
while(!place_meeting(round(x+sign(hsp)),round(y),obj_block)) x += sign(hsp);
hsp = 0;
} if (!place_meeting(round(x+hsp),round(y+1),obj_block))
{
vsp = -6;
}
Last edited: