Basic Movement from Keyboard
1. Create new movie clip - any name (doesn't matter)
2. Add movie clip to stage
2. Change Instance name in properties panel - myMovieClip
3. Select myMovieClip with arrow tool
4. Open Action script panel and paste this code -
onClipEvent(enterFrame){
if (Key.isDown(Key.RIGHT)) {
_root.myMovieClip._x += 10;
}
if (Key.isDown(Key.LEFT)) {
_root.myMovieClip._x -= 10;
}
if (Key.isDown(Key.DOWN)) {
_root.myMovieClip._y += 10;
}
if (Key.isDown(Key.UP)) {
_root.myMovieClip._y -= 10;
}
}
5. Control --> Test Movie... use arrow keys to move clip around. Save as movement_mc.fla
6. Challenge - modify code to make quicker, slower, etc... other key inputs? 2 players? 2 movie clips?