- First draw you charector from a birds eye view (looking from above)
- Now Hit "Ctrl + F8"
- Now Name it and select "Movieclip"
- Then click "OK"
- Click on your charector and give it the instince name of "man"
- Now put the following script on your character:
- onClipEvent (load) {
- fight = false;
- }
- onClipEvent (enterFrame) {
- if (fight == false) {
- if (Key.isDown(Key.LEFT) && fight != true) {
- _rotation = 270;
- this._x -= 5
- }
- else if (Key.isDown(Key.RIGHT) && fight != true) {
- _rotation = 90;
- this._x += 5
- }
- if (Key.isDown(Key.UP) && fight != true) {
- _rotation = 0;
- this._y += 5
- }
- else if (Key.isDown(Key.DOWN) && fight != true) {
- _rotation = 180;
- this._y -=5
- }
- }
- }
- onClipEvent (enterFrame) {
- if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {
- _rotation = 225;
- }
- if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {
- _rotation = 45;
- }
- if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {
- _rotation = 135;
- }
- if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {
- _rotation = 315;
- }
- }
And there you go! Now test your movie/game by hitting "Ctrl + Enter". That will create an swf file (thats the actual movie/game file that you would give to your friends or upload to the internet.
2 comments:
I think hitTest function is mising somewhere
no hit test is required for this step, this only makes your player rotate in the right direction by pressing the arrow keys. This DOES NOT move your charector, it just rotates him/her.
Post a Comment