The First Steps to your 2D Game
First open Flash and a new Actionscript 2.0 file.
Next using the shape tool, draw a shape or your character (note you can make it look better later).
Next using the shape tool, draw a shape or your character (note you can make it look better later).
Next make the shape a Movie Clip this is done by either selecting the shape and pushing f8 or Modify --> Convert to Symbol.
Make sure that it is set for Movie Clip and registration centre.
Make sure that it is set for Movie Clip and registration centre.
And now you have a moving character! But the code given allows you to move even on angles! If you don't want that to happen change the code to:
onClipEvent(load){
rightspeed = 5;
leftspeed = 5;
upspeed = 5
downspeed = 5;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.LEFT)){
this._x -= leftspeed;
}else if(Key.isDown(Key.RIGHT)){
this._x += rightspeed;
}else if(Key.isDown(Key.UP)){
this._y -= upspeed;
}else if(Key.isDown(Key.DOWN)){
this._y += downspeed;
}
}
Onto part 2.
onClipEvent(load){
rightspeed = 5;
leftspeed = 5;
upspeed = 5
downspeed = 5;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.LEFT)){
this._x -= leftspeed;
}else if(Key.isDown(Key.RIGHT)){
this._x += rightspeed;
}else if(Key.isDown(Key.UP)){
this._y -= upspeed;
}else if(Key.isDown(Key.DOWN)){
this._y += downspeed;
}
}
Onto part 2.