P
Patrick Johnson
Guest
I'm having an issue with the "while" and "if" statement in my code. I run the compiler but it says that the function is malformed, regardless of whether or not I use "while" or "if". It works fine in GMS 1.4 but not GMS2.
/// Code in the game > o_enemy > create event ///
if(distance_to_object(o_player)<100);
{
x = random(room_width);
y = random(room_height);
}
///end malformation code///
It should be in the create event, but I also tried it in the step event for kicks and giggles, still no luck. The point is to get the enemy to spawn away from the position of the player so that way it doesnt stack on top and kill the player randomly. Any advice? I'm scratching my head.
Cheers
/// Code in the game > o_enemy > create event ///
if(distance_to_object(o_player)<100);
{
x = random(room_width);
y = random(room_height);
}
///end malformation code///
It should be in the create event, but I also tried it in the step event for kicks and giggles, still no luck. The point is to get the enemy to spawn away from the position of the player so that way it doesnt stack on top and kill the player randomly. Any advice? I'm scratching my head.
Cheers