Coding movement

We know how to use F6 to change the position of something on an animation stage, or we could use motion tweens.

But can we write code to move a character around the game area?

You bet we can!


Watch the video. It is about 10 minutes long. It will introduce you to Actionscript 3.0, a coding language, and also co-ordinates in Flash. Also copy and paste the starter code into your Actions window.

You challenge is to choose challenge A, B, C or D

  • Challenge A has 2 balls moving towards each other on the x-axis, in the middle of the game area.
  • Challenge B has 2 balls moving towards each other on the y-axis, in the middle of the game area.
  • Challenge C has 4 balls all moving to the center of the game area.
  • Challenge D has 8 balls all starting at the centre of the game area and moving out in different directions.

Copy and paste your code into a Google Doc called "Moving the Ball". Can you explain how the code works?