Flash Tutorial
#1

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:
Код:
onClipEvent(enterFrame){
	
}
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:

Код:
	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;
	}
You may now be like BLAHSBW what is that?

I will now describe it line by line.

Код:
if(Key.isDown(Key.LEFT)){
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._x -= 3;
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.
Reply
#2

Basic, but shows basic functionality of Flash Pro CS5. Nice work.
Reply
#3

I'm not sure if this work's in action script 3 as I have not done that yet, but I'm guessing.

If someone can confirm that would be nice
Reply
#4

Quote:
Originally Posted by Mrkrabz
Посмотреть сообщение
I'm not sure if this work's in action script 3 as I have not done that yet, but I'm guessing.

If someone can confirm that would be nice
So far as i know there is no "Key.isDown" in Actionscript 3 anymore - and you have to do it with "AddEventListener"(Or how they are called :P)
Reply
#5

Quote:
Originally Posted by BMGP
Посмотреть сообщение
So far as i know there is no "Key.isDown" in Actionscript 3 anymore - and you have to do it with "AddEventListener"(Or how they are called :P)
Oh great, it will be like learning it all over again -.-
Reply
#6

Quote:
Originally Posted by Mrkrabz
Посмотреть сообщение
Oh great, it will be like learning it all over again -.-
exactly xD - you are moving to As3 instead of 2?
Reply
#7

Quote:
Originally Posted by BMGP
Посмотреть сообщение
exactly xD - you are moving to As3 instead of 2?
Not yet, I'm going to do a little more in AS2
Reply
#8

Actually I have to admit, that the tutorial is quit good
btw did you notice your PM ? you don't seem checking them :^ :P

- Ecko
Reply
#9

I don't check my PM's i have like 50 unread PM's from 2 weeks ago. but ill have a quick check.
Reply
#10

I'd put all my script on the main time line instead and giving the movieclips instance names, also it wouldn't work in AS 3.0.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)