Friday, February 7, 2014

Let's Get Moving

Today in 7th grade we went over some scripting for the backdrops and the basic movements our animated sprite, or the sprite that will move through the maze. 

We discussed the following class:

Sprites - Animated vs. Static

During game play we will need to use specific keys on the keyboard to navigate a sprite through the maze.

For Level One students can either use the sprites available in Scratch or create sprites using Pixlr.

At minimum for each level we will be using three sprites:

  • One animated sprite (moves during game play) 
  • Two static sprites (does not move during game play) 
Movement - Animated Sprite 

For this example I will use the “Pico walking” sprite which is available within the Scratch Library. You are not limited to the Scratch sprite library. Please create your own in Pixlr to match the theme of your game.
  • To import “Pico walking” into the Sprites area I simply need to click on
  • Now lets develop some pseudo-code to move our sprite 
  • Press arrow keys to move in a direction 
  • Press the right arrow key 
  • Point or orient my sprite in a certain direction 
  • Move in the positive/negative x direction some distance 
  • Move in the positive/negative y direction some distance

  • Finally when the animated sprite for Level One displays on Maze One we want it to be in a static location (x, y). We also need to change the sprites rotation from 360o to 90o. This allows the sprite to flip left and right when the left and right arrow keys are pressed. 
  • From the pseudo-code above we need two different scripts.

  • To change the rotational property we need to click on the “i” in the upper left corner of the sprite icon.
  • Each sprite by default is given 360 rotational style. We need to change this to be a 90 rotational style. simply select the left and right arrow option.

Sensing - The Maze Boundary

  • If touching color of the maze boundary then go back to the start. 
Pretty simple, but we need this script to loop continuously during Level One

The script will look like:

More instructions can be found on http://bit.ly_scratch_maze