Oiykk - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of Oiykk.php

  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. }
  41.  
  42. function moving_south(this_sprite) {
  43.   moveInDirection(this_sprite, getProp(this_sprite, "speed"), "South");
  44. }
  45.  
  46. function math_random_int(a, b) {
  47.   if (> b) {
  48.     // Swap a and b to ensure a is smaller.
  49.     var c = a;
  50.     a = b;
  51.     b = c;
  52.   }
  53.   return Math.floor(Math.random() * (- a + 1) + a);
  54. }
  55.  
  56. function jittering(this_sprite) {
  57.   changePropBy(this_sprite, "scale", math_random_int(-1, 1));
  58. }
  59.  
  60. function wandering(this_sprite) {
  61.   if (math_random_int(0, 5) == 0) {
  62.     changePropBy(this_sprite, "direction", math_random_int(-25, 25));
  63.   }
  64.   moveForward(this_sprite, 1);
  65.   if (isTouchingEdges(this_sprite)) {
  66.     edgesDisplace(this_sprite);
  67.     changePropBy(this_sprite, "direction", math_random_int(135, 225));
  68.   }
  69. }
  70.  
  71. function shrinking(this_sprite) {
  72.   changePropBy(this_sprite, "scale", -1);
  73. }
  74.  
  75. function spinning_left(this_sprite) {
  76.   turn(this_sprite, 6, "left");
  77. }
  78.  
  79. function moving_with_arrow_keys(this_sprite) {
  80.   if (isKeyPressed("up")) {
  81.     moveInDirection(this_sprite, getProp(this_sprite, "speed"), "North");
  82.   }
  83.   if (isKeyPressed("down")) {
  84.     moveInDirection(this_sprite, getProp(this_sprite, "speed"), "South");
  85.   }
  86.   if (isKeyPressed("left")) {
  87.     moveInDirection(this_sprite, getProp(this_sprite, "speed"), "West");
  88.   }
  89.   if (isKeyPressed("right")) {
  90.     moveInDirection(this_sprite, getProp(this_sprite, "speed"), "East");
  91.   }
  92. }
  93.  
  94. function driving_with_arrow_keys(this_sprite) {
  95.   if (isKeyPressed("up")) {
  96.     moveForward(this_sprite, getProp(this_sprite, "speed"));
  97.   }
  98.   if (isKeyPressed("down")) {
  99.     moveBackward(this_sprite, getProp(this_sprite, "speed"));
  100.   }
  101.   if (isKeyPressed("left")) {
  102.     changePropBy(this_sprite, "direction", -5);
  103.     changePropBy(this_sprite, "rotation", -5);
  104.   }
  105.   if (isKeyPressed("right")) {
  106.     changePropBy(this_sprite, "direction", 5);
  107.     changePropBy(this_sprite, "rotation", 5);
  108.   }
  109.   if (isTouchingEdges(this_sprite)) {
  110.     edgesDisplace(this_sprite);
  111.   }
  112. }
  113.  
  114. function fluttering(this_sprite) {
  115.   changePropBy(this_sprite, "y", math_random_int(-1, 1));
  116. }
  117.  
  118. function wobbling(this_sprite) {
  119.   withPercentChance(50, function () {
  120.     setProp(this_sprite, "rotation", math_random_int(-1, 1));
  121.   });
  122. }
  123.  
  124. function moving_west_and_looping(this_sprite) {
  125.   mirrorSprite(this_sprite, "left");
  126.   moveInDirection(this_sprite, getProp(this_sprite, "speed"), "West");
  127.   if (getProp(this_sprite, "x") < -50) {
  128.     setProp(this_sprite, "x", 450);
  129.   }
  130. }
  131.  
  132. function moving_east_and_looping(this_sprite) {
  133.   mirrorSprite(this_sprite, "right");
  134.   moveInDirection(this_sprite, getProp(this_sprite, "speed"), "East");
  135.   if (getProp(this_sprite, "x") > 450) {
  136.     setProp(this_sprite, "x", -50);
  137.   }
  138. }
  139.  
  140. makeNewSpriteAnon("hippo", ({"x":137,"y":67}));
  141.  
  142. spriteClicked("when", ({costume: "hippo"}), function (extraArgs) {
  143.   setAnimation(({costume: "hippo"}), "brown bunny");
  144. });
  145.  
  146. atTime(1, "seconds", function (extraArgs) {
  147.   setBackgroundImageAs("sci_fi");
  148.   for (var count = 0; count < 10; count++) {
  149.     jumpTo(({costume: "hippo"}), ({"x":248,"y":313}));
  150.   }
  151. });
  152.  
  153. /*
  154. randomLocation();
  155. */
  156.  
File Description
  • Oiykk
  • PHP Code
  • 25 Nov-2022
  • 4.21 Kb
You can Share it: