[text] h

Viewer

  1. function moving_west(this_sprite) {
  2.   moveInDirection(this_sprite, getProp(this_sprite, "speed"), "West");
  3. }
  4.  
  5. function spinning_right(this_sprite) {
  6.   turn(this_sprite, 6, "right");
  7. }
  8.  
  9. function growing(this_sprite) {
  10.   changePropBy(this_sprite, "scale", 1);
  11. }
  12.  
  13. function swimming_left_and_right(this_sprite) {
  14.   if (getProp(this_sprite, "direction") == 0) {
  15.     mirrorSprite(this_sprite, "right");
  16.   } else if (getProp(this_sprite, "direction") == 180) {
  17.     mirrorSprite(this_sprite, "left");
  18.   }
  19.   moveForward(this_sprite, getProp(this_sprite, "speed"));
  20.   if (isTouchingEdges(this_sprite)) {
  21.     edgesDisplace(this_sprite);
  22.     changePropBy(this_sprite, "direction", 180);
  23.   }
  24. }
  25.  
  26. function moving_east(this_sprite) {
  27.   moveInDirection(this_sprite, getProp(this_sprite, "speed"), "East");
  28. }
  29.  
  30. function moving_north(this_sprite) {
  31.   moveInDirection(this_sprite, getProp(this_sprite, "speed"), "North");
  32. }
  33.  
  34. function patrolling(this_sprite) {
  35.   moveForward(this_sprite, getProp(this_sprite, "speed"));
  36.   if (isTouchingEdges(this_sprite)) {
  37.     edgesDisplace(this_sprite);
  38.     changePropBy(this_sprite, "direction", 180);
  39.   }
  40.   if (getProp(this_sprite, "direction") > 270 || getProp(this_sprite, "direction") < 90) {
  41.     mirrorSprite(this_sprite, "right");
  42.   } else {
  43.     mirrorSprite(this_sprite, "left");
  44.   }
  45.  
  46. }
  47.  
  48. function moving_south(this_sprite) {
  49.   moveInDirection(this_sprite, getProp(this_sprite, "speed"), "South");
  50. }
  51.  
  52. function math_random_int(a, b) {
  53.   if (a > b) {
  54.     // Swap a and b to ensure a is smaller.
  55.     var c = a;
  56.     a = b;
  57.     b = c;
  58.   }
  59.   return Math.floor(Math.random() * (b - a + 1) + a);
  60. }
  61.  
  62. function jittering(this_sprite) {
  63.   changePropBy(this_sprite, "scale", math_random_int(-1, 1));
  64. }
  65.  
  66. function wandering(this_sprite) {
  67.   withPercentChance(20, function () {
  68.     changePropBy(this_sprite, "direction", math_random_int(-25, 25));
  69.   });
  70.   moveForward(this_sprite, getProp(this_sprite, "speed"));
  71.   if (isTouchingEdges(this_sprite)) {
  72.     edgesDisplace(this_sprite);
  73.     changePropBy(this_sprite, "direction", math_random_int(135, 225));
  74.   }
  75.   if (getProp(this_sprite, "direction") > 270 || getProp(this_sprite, "direction") < 90) {
  76.     mirrorSprite(this_sprite, "right");
  77.   } else {
  78.     mirrorSprite(this_sprite, "left");
  79.   }
  80.  
  81. }
  82.  
  83. function shrinking(this_sprite) {
  84.   changePropBy(this_sprite, "scale", -1);
  85. }
  86.  
  87. function spinning_left(this_sprite) {
  88.   turn(this_sprite, 6, "left");
  89. }
  90.  
  91. function moving_with_arrow_keys(this_sprite) {
  92.   if (isKeyPressed("up")) {
  93.     moveInDirection(this_sprite, getProp(this_sprite, "speed"), "North");
  94.   }
  95.   if (isKeyPressed("down")) {
  96.     moveInDirection(this_sprite, getProp(this_sprite, "speed"), "South");
  97.   }
  98.   if (isKeyPressed("left")) {
  99.     moveInDirection(this_sprite, getProp(this_sprite, "speed"), "West");
  100.   }
  101.   if (isKeyPressed("right")) {
  102.     moveInDirection(this_sprite, getProp(this_sprite, "speed"), "East");
  103.   }
  104. }
  105.  
  106. function driving_with_arrow_keys(this_sprite) {
  107.   if (isKeyPressed("up")) {
  108.     moveForward(this_sprite, getProp(this_sprite, "speed"));
  109.   }
  110.   if (isKeyPressed("down")) {
  111.     moveBackward(this_sprite, getProp(this_sprite, "speed"));
  112.   }
  113.   if (isKeyPressed("left")) {
  114.     changePropBy(this_sprite, "direction", -5);
  115.     changePropBy(this_sprite, "rotation", -5);
  116.   }
  117.   if (isKeyPressed("right")) {
  118.     changePropBy(this_sprite, "direction", 5);
  119.     changePropBy(this_sprite, "rotation", 5);
  120.   }
  121.   if (isTouchingEdges(this_sprite)) {
  122.     edgesDisplace(this_sprite);
  123.   }
  124. }
  125.  
  126. function fluttering(this_sprite) {
  127.   changePropBy(this_sprite, "y", math_random_int(-1, 1));
  128. }
  129.  
  130. function wobbling(this_sprite) {
  131.   withPercentChance(50, function () {
  132.     setProp(this_sprite, "rotation", math_random_int(-1, 1));
  133.   });
  134. }
  135.  
  136. function moving_west_and_looping(this_sprite) {
  137.   mirrorSprite(this_sprite, "left");
  138.   moveInDirection(this_sprite, getProp(this_sprite, "speed"), "West");
  139.   if (getProp(this_sprite, "x") < -50) {
  140.     setProp(this_sprite, "x", 450);
  141.   }
  142. }
  143.  
  144. function moving_east_and_looping(this_sprite) {
  145.   mirrorSprite(this_sprite, "right");
  146.   moveInDirection(this_sprite, getProp(this_sprite, "speed"), "East");
  147.   if (getProp(this_sprite, "x") > 450) {
  148.     setProp(this_sprite, "x", -50);
  149.   }
  150. }
  151.  
  152. function moving_north_and_looping(this_sprite) {
  153.   moveInDirection(this_sprite, getProp(this_sprite, "speed"), "North");
  154.   if (getProp(this_sprite, "y") > 450) {
  155.     setProp(this_sprite, "y", -50);
  156.   }
  157. }
  158.  
  159. function moving_south_and_looping(this_sprite) {
  160.   moveInDirection(this_sprite, getProp(this_sprite, "speed"), "South");
  161.   if (getProp(this_sprite, "y") < -50) {
  162.     setProp(this_sprite, "y", 450);
  163.   }
  164. }
  165.  
  166. setBackgroundImageAs("hw_plate_background_1");
  167. makeNewSpriteAnon("face_pizza_1", ({"x":190,"y":117}));
  168. makeNewSpriteAnon("face_cupcake_1", ({"x":106,"y":230}));
  169. makeNewSpriteAnon("face_sandwich_1", ({"x":197,"y":304}));
  170. makeNewSpriteAnon("face_fries_1", ({"x":296,"y":213}));
  171.  
  172. spriteClicked("when", ({costume: "face_pizza_1"}), function (extraArgs) {
  173.   spriteSayTime(({costume: "face_pizza_1"}), 'Howdy!', 2);
  174.   setBackgroundImageAs("hw_plate_background_1");
  175. });
  176.  
  177. keyPressed("when", "left", function () {
  178.   makeBurst(100, "face_cupcake_1", "spiral");
  179.   spriteSayTime(({costume: "face_cupcake_1"}), 'Suprise!', 2);
  180. });
  181.  
  182. spriteClicked("when", ({costume: "face_cupcake_1"}), function (extraArgs) {
  183.   spriteSayTime(({costume: "face_cupcake_1"}), 'Suprise!', 2);
  184.   setBackgroundImageAs("abstract_26_1");
  185. });
  186.  
  187. keyPressed("when", "down", function () {
  188.   makeBurst(100, "face_pizza_1", "rain");
  189.   spriteSayTime(({costume: "face_pizza_1"}), 'Howdy!', 2);
  190. });
  191.  
  192. spriteClicked("when", ({costume: "face_fries_1"}), function (extraArgs) {
  193.   spriteSayTime(({costume: "face_fries_1"}), 'Have a good time', 2);
  194.   setBackgroundImageAs("abstract_15_1");
  195. });
  196.  
  197. keyPressed("when", "up", function () {
  198.   makeBurst(100, "face_fries_1", "pop");
  199.   spriteSayTime(({costume: "face_fries_1"}), 'Have a good time', 2);
  200. });
  201.  
  202. keyPressed("when", "right", function () {
  203.   makeBurst(100, "face_sandwich_1", "burst");
  204.   spriteSayTime(({costume: "face_sandwich_1"}), 'Happy Holidays', 2);
  205. });
  206.  
  207. spriteClicked("when", ({costume: "face_sandwich_1"}), function (extraArgs) {
  208.   spriteSayTime(({costume: "face_sandwich_1"}), 'Happy Holidays', 2);
  209.   setBackgroundImageAs("abstract_16_1");
  210. });

Editor

You can edit this paste and save as new: