User:Cjadams511

var growing; var moving_with_arrow_keys; var moving_west; var spinning_right; var swimming_left_and_right; var moving_east; var moving_north; var patrolling; var moving_south; var jittering; var wandering; var shrinking; var spinning_left;

function moving_with_arrow_keys2(this_sprite) { if (isKeyPressed("up")) { moveInDirection(this_sprite, 1, "North"); } if (isKeyPressed("down")) { moveInDirection(this_sprite, 1, "South"); } if (isKeyPressed("left")) { moveInDirection(this_sprite, 1, "West"); } if (isKeyPressed("right")) { moveInDirection(this_sprite, 1, "East"); } }

function growing2(this_sprite) { changePropBy(this_sprite, "scale", 25); }

function moving_west2(this_sprite) { moveInDirection(this_sprite, 5, "West"); }

function spinning_right2(this_sprite) { turn(this_sprite, 6, "right"); }

function swimming_left_and_right2(this_sprite) { if (getProp(this_sprite, "direction") == 0) { mirrorSprite(this_sprite, "right"); } else if (getProp(this_sprite, "direction") == 180) { mirrorSprite(this_sprite, "left"); } moveForward(this_sprite, 5); if (isTouchingEdges(this_sprite)) { edgesDisplace(this_sprite); changePropBy(this_sprite, "direction", 180); } }

function moving_east2(this_sprite) { moveInDirection(this_sprite, 5, "East"); }

function moving_north2(this_sprite) { moveInDirection(this_sprite, 5, "North"); }

function patrolling2(this_sprite) { moveForward(this_sprite, 5); if (isTouchingEdges(this_sprite)) { edgesDisplace(this_sprite); changePropBy(this_sprite, "direction", 180); } }

function moving_south2(this_sprite) { moveInDirection(this_sprite, 5, "South"); }

function math_random_int(a, b) { if (a > b) { // Swap a and b to ensure a is smaller. var c = a;   a = b;    b = c;  } return Math.floor(Math.random * (b - a + 1) + a); }

function jittering2(this_sprite) { changePropBy(this_sprite, "scale", math_random_int(-1, 1)); }

function wandering2(this_sprite) { if (math_random_int(0, 5) == 0) { changePropBy(this_sprite, "direction", math_random_int(-25, 25)); } moveForward(this_sprite, 1); if (isTouchingEdges(this_sprite)) { edgesDisplace(this_sprite); changePropBy(this_sprite, "direction", math_random_int(135, 225)); } }

function shrinking2(this_sprite) { changePropBy(this_sprite, "scale", -1); }

function spinning_left2(this_sprite) { turn(this_sprite, 6, "left"); }

makeNewSpriteAnon("crab", ({"x":189,"y":349})); makeNewSpriteAnon("sun2_1", ({"x":349,"y":50})); makeNewSpriteAnon("cloud", ({"x":82,"y":85})); makeNewSpriteAnon("cloud", ({"x":286,"y":133})); setBackground('#ffff99'); setBackgroundImage("https://studio.code.org/blockly/media/skins/studio/background_desert.png"); setTint(({costume: "sun2_1"}), '#c0c0c0'); setTint(({costume: "cloud"}), '#c0c0c0');

atTime(3, "seconds", function (extraArgs) { addBehaviorSimple(({costume: "crab"}), new Behavior(growing2, [])); });

atTime(4, "seconds", function (extraArgs) { removeBehaviorSimple(({costume: "crab"}), new Behavior(growing2, []));  setTint(({costume: "crab"}), '#66ff99');  comment("I am evil!!!");  addBehaviorSimple(({costume: "crab"}), new Behavior(moving_with_arrow_keys2, [])); });