SpriterDrag

GM Block Tutorial

Mar 16th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Create Event:
  2. ---------------------------------------------------------------
  3. image_speed = 0.1
  4. ready = 0
  5. ready2 = 0
  6. //This will make the block solid.
  7.     mysolid = instance_create(x,y,obj_solidblock)
  8.  
  9. Destroy Event: (Use this one on the brick block.)
  10. ---------------------------------------------------------------
  11. with (mysolid) instance_destroy();
  12.  
  13. Step Event:
  14. ---------------------------------------------------------------
  15. if ((vspeed > 0) && (y > ystart-4))
  16. {
  17.     //Add here the object you want to make appear on the block.
  18.     y = ystart
  19.     vspeed = 0
  20.     ready = 2
  21.     //Changes the sprite.
  22.         sprite_index = spr_qblock_empty
  23. }
  24. if (ready == 1)
  25.     vspeed += 0.5
  26.  
  27. Begin Step Event: [?] Block
  28. ---------------------------------------------------------------
  29. if ((collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom,obj_player,1,1)) && (ready == 0))
  30. {
  31.     vspeed = -4
  32.     //Makes the block unable to be used.
  33.     ready = 1
  34. }
  35.  
  36. Begin Step Event: Brick Block
  37. ---------------------------------------------------------------
  38. if ((collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom,obj_player,1,1)) && (ready == 0))
  39. {
  40.     alarm[0] = 2 <-- Destroy the object on that event and add some shard object on it.
  41.     exit;
  42. }
Add Comment
Please, Sign In to add comment