Game Techniques 1

From ReThinkWiki

Jump to: navigation, search

Contents

Topic Summary

  • Study ActionScript code to create a control loop, move a character and detect collisions.

Topics Assignments

Final Project Design Document

1. Learn how to Move a character in Flash.

Related Links and Tutorials

Notes and Comments

Coordinates

  • Move MovieClips on screen using x, y designations
  • x=0 is left edge, y=0 is top of screen
  • Stage.width is right edge of screen, Stage.height is bottom of screen
  • Top, Left corner is 0,0
  • To move to middle of screen
carMC._x = Stage.width/2;
carMC._y = Stage.height/2;

onEnterFrame

  • is a function called by Flash Player when a new frame is triggered, even when a movie clip is stopped
  • can be used in games as a control loop
onEnterFrame = function() {
   if (carMC._x + speed < Stage.width) {
      carMC._x += speed;
   }
}

Search the Web for more information

Here are some search results on Flash Character movment:

Personal tools