External Exam Download Resources Web Applications Games Recycle Bin

Collisions


create event for ball - see previous Movement page (has not changed)

better way (note this is now in a Step event):

note:


Create event:

myDirection = random(360)
motion_set(myDirection,3)

Step event:

if(place_meeting(x+hspeed,y,objWall)) or 
  (place_meeting(x+hspeed,y,objBall))
  {
    hspeed *= -1;
  }

if(place_meeting(x,y+vspeed,objWall)) or
  (place_meeting(x,y+vspeed,objBall))
  {
    vspeed *= -1
  }

note - the previous step event could be shortened to: move_bounce_all(true)