Advertisement
Guest User

bloon

a guest
May 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. var balloon = createSprite(200,200);
  2. balloon.setAnimation("balloon");
  3. balloon.debug = true;
  4.  
  5. var tack = createSprite(350, 50);
  6. tack.setAnimation("tack");
  7. tack.debug = true;
  8.  
  9. function draw() {
  10. background("gray");
  11.  
  12. // check if tack is touching balloon
  13. if (balloon.isTouching(tack)) {
  14. // replace balloon image
  15. balloon.setAnimation("popped");
  16. }
  17. // make tack move with arrow keys
  18. if (keyDown("up")) {
  19. tack.y = tack.y - 1;
  20. }
  21. if (keyDown("down")) {
  22. tack.y = tack.y + 1;
  23. }
  24. if (keyDown("left")) {
  25. tack.x = tack.x - 1;
  26. }
  27. if (keyDown("right")) {
  28. tack.x = tack.x + 1;
  29. }
  30.  
  31. drawSprites();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement