27.10.2010, 13:09
Well i have had request's to make a flash tutorial because of my past games i have made (Maze, Zombie. etc.)
Well here it is, the main tutorial was on Underground-gfx.info
----------------------------------------------------------------------------------------------------------------
This is just a quick picture tutorial, which can make an object move with arrow keys :3
First start a new flash document (File > New) if you are using adobe CS5 then it may ask for which script. make sure you choose ActionScript 2.0
/imageshack/img225/3860/81281391.png
Right click on our first frame and select Actions
/imageshack/img29/3495/35077801.png
Type stop(); into the action coding area. This stop the frame looping and carrying onto the next frame. Now close the window.
/imageshack/img25/48/44963035.png
Now, draw a basic square/Circle or w/e you want to move onto our frame.
/imageshack/img507/1554/69750430.png
After we have done that, select the object we just drew, by holding your mouse down and selecting a box around it (Make sure you don't just click it.)
/imageshack/img109/8572/37402518.png
After right click > Convert to Symbol
/imageshack/img824/889/73470970.png
Call it Person and make sure it's a movieclip
/imageshack/img840/4707/49071155.png
Press Ok. Now we want to right click our newly made square/object and select actions.
/imageshack/img25/9538/51519717.png
In our action window type:
This is required on all objects etc. I will mention later on what this does. It should now look like this:
/imageshack/img838/8724/72796712.png
Inside the onClipEvent you want to type:
You may now be like BLAHSBW what is that?
I will now describe it line by line.
Basically this is saying If the key is pressed down, which is key Left, so if Key left is pressed down then.. (Key left is left arrow key.)
this. is our object (our person w/e)
_x is our x axis, Y is up and down. X is left and right.
So what we are doing here is taking 3 from X which makes him move 3 points left. you should now be able to guess what the rest means as it's the same as what i have just described but changed slightly.
Your code window should now look like this:
/imageshack/img835/8092/47068595.png
Now press CTRL + Enter to run your animation and try pressing your left right up and down arrow keys.
A new tutorial will be coming soon. check the forums.
Well here it is, the main tutorial was on Underground-gfx.info
----------------------------------------------------------------------------------------------------------------
This is just a quick picture tutorial, which can make an object move with arrow keys :3
First start a new flash document (File > New) if you are using adobe CS5 then it may ask for which script. make sure you choose ActionScript 2.0
/imageshack/img225/3860/81281391.png
Right click on our first frame and select Actions
/imageshack/img29/3495/35077801.png
Type stop(); into the action coding area. This stop the frame looping and carrying onto the next frame. Now close the window.
/imageshack/img25/48/44963035.png
Now, draw a basic square/Circle or w/e you want to move onto our frame.
/imageshack/img507/1554/69750430.png
After we have done that, select the object we just drew, by holding your mouse down and selecting a box around it (Make sure you don't just click it.)
/imageshack/img109/8572/37402518.png
After right click > Convert to Symbol
/imageshack/img824/889/73470970.png
Call it Person and make sure it's a movieclip
/imageshack/img840/4707/49071155.png
Press Ok. Now we want to right click our newly made square/object and select actions.
/imageshack/img25/9538/51519717.png
In our action window type:
Код:
onClipEvent(enterFrame){ }
/imageshack/img838/8724/72796712.png
Inside the onClipEvent you want to type:
Код:
if(Key.isDown(Key.LEFT)){ this._x -= 3; } if(Key.isDown(Key.RIGHT)){ this._x += 3; } if(Key.isDown(Key.UP)){ this._y -= 3; } if(Key.isDown(Key.DOWN)){ this._y += 3; }
I will now describe it line by line.
Код:
if(Key.isDown(Key.LEFT)){
Код:
this._x -= 3;
_x is our x axis, Y is up and down. X is left and right.
So what we are doing here is taking 3 from X which makes him move 3 points left. you should now be able to guess what the rest means as it's the same as what i have just described but changed slightly.
Your code window should now look like this:
/imageshack/img835/8092/47068595.png
Now press CTRL + Enter to run your animation and try pressing your left right up and down arrow keys.
A new tutorial will be coming soon. check the forums.