• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Or, in if statements?

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
You cannot use "or" to indicate that you want either of two objects - you'll want either to split them into separate !place_meeting checks, or make a script that takes a variable number of object arguments and checks for any of those,
Code:
/// place_meeting_either(x, y, ...objects)
for (var i = 2; i < argument_count; i++) {
    if (place_meeting(argument[0], argument[1], argument[i])) return true;
}
return false;
...
Code:
if (!place_meeting_either(x, y + ySpeed, oWall, oLasi) and ...)
 
V

Vinha

Guest
You cannot use "or" to indicate that you want either of two objects - you'll want either to split them into separate !place_meeting checks, or make a script that takes a variable number of object arguments and checks for any of those,
Code:
/// place_meeting_either(x, y, ...objects)
for (var i = 2; i < argument_count; i++) {
    if (place_meeting(argument[0], argument[1], argument[i])) return true;
}
return false;
...
Code:
if (!place_meeting_either(x, y + ySpeed, oWall, oLasi) and ...)
Thanks a lot. It works now :)!!!
 
Top