X
Xocolade
Guest
Hello ! I am new to Game Maker , and i've been trying to create a mega man style game . I created an enemy , which goes from one side to another . This is the code i used for the enemy to change it's direction when it collides with an object .
( Image_index ==0 means sprite facing the right direction )
( Image_index ==1 means sprite facing the left direction )
/// Changing Direction
// Changing to right
if (place_meeting(x+1,y,obj_movenemy)){
image_index = 1;
}
// Changing to left
if (place_meeting(x-1,y,obj_movenemy)){
image_index = 0;
}
Problem is : since this is running on a step event , it will constantly set the image index to 0 or 1 , meaning the enemy will bug out and keep changing its frame constantly . Is there any way i can set the image index only ONE time ?
Sorry for bad english , i am brazillian .
( Image_index ==0 means sprite facing the right direction )
( Image_index ==1 means sprite facing the left direction )
/// Changing Direction
// Changing to right
if (place_meeting(x+1,y,obj_movenemy)){
image_index = 1;
}
// Changing to left
if (place_meeting(x-1,y,obj_movenemy)){
image_index = 0;
}
Problem is : since this is running on a step event , it will constantly set the image index to 0 or 1 , meaning the enemy will bug out and keep changing its frame constantly . Is there any way i can set the image index only ONE time ?
Sorry for bad english , i am brazillian .