vspeed > 0 && y < other.y+8
is true. So what does this expression mean? If vspeed > 0
then we know that the vertical speed of the player character is greater than zero – that is, the player character is moving in the positive y direction – downwards, in other words (remember, the origin x=0, y=0 is in the top left of the room, with positive x to the right, and positive y pointing down.).&&
means ‘logical AND’. That is, both the first part of the expression (vspeed > 0
) and the second part of the expression (y < other.y+8
) must BOTH be true, at the same time for the whole expression to be true.y < other.y+8
mean? other
corresponds to the other object instance in the collision – that is, a monster. The expression tests that current position of the player character is above the bottom of the monster character. Since we know the player character has collided with the monster, and the other half of the expression (vspeed > 0
) is checking that the player character is moving downwards, this means essentially that the player character must have fallen onto the monster character. So it must die…Start of a block
and End of a block
statements group sets of action that are to be executed if the condition evaluates true or false. The comment action (the exclamation mark) is just there for our benefit – comments are ignored by Game Maker and are simply used to act as inline documentation for a game programme.obj_bullet
) depicted by an appropriate sprite (spr_bullet
).sprite_index
; if we are using a single sprite with several subimages, we need to check the variable image_index
.