PDA

View Full Version : How to make a 'Storm the House' style game [Flash][Actionscript]



Raffi
01-02-2008, 01:55 AM
Okay, this is pretty complex, but here goes. This tut is to make one of those games where guys run along and you click on them to shoot and kill them!

Okay, first, you make a new document in Flash.
Now draw your enemy. Make it a MOVIE CLIP. Give it the instance name 'guy' without the ''s.

Now add a second keyframe in the movie clip.
In the first KF, make the enemy a movie clip again. Instance Name it 'run' (without the ''s).
Now make your anim of your enemy running or whatever in the MC.
Now, exit the running MC and go to the second keyframe. Make the guy an MC and Instance name it 'die'. It's obvious why that is!

Now for the coding.

For the Guy MC, give it this code:

onClipEvent (enterFrame) {
speed = 5;
this._x += speed;
}
This code makes your enemy run to the right of the screen. Edit the speed if you like.

Now exit the die MC and add this code to it:

onClipEvent (enterFrame) {
speed = 5;
this._x += speed;
}
This nuetralises the speed of the guy MC, thus causing the MC to stay where it is.

There is no code for the running MC.

Now, on BOTH of the Keyframes in the guy MC, add the code:

stop ();
Now exit the entire guy MC and give the main MC this code:

onClipEvent (enterFrame) {
speed = -5;
this._x += speed;
}
on (release) {
gotoAndPlay("dead");
}
Extra note: If your enemy is a stickman, add another layer in the guy MC and and draw a transparent square, covering the stickman.

Also, feel free to add any sound.

FINAL TIP: Copy and paste your enemy MC to make multiple enemies.
Also, add this code at the beginning of the die frame if you are adding a score feature in your game.

_root.score.text++;
Add this code to and frame of your DIEING MC.

Afterwards, exit the dieing MC and the guy MC.
Now add a dynamic text box to the scene. Instance name it 'score'.

AND THERE YOU ARE! TEST THE MOVIE!
If anything is not working, tell me and I'll try to sort it out. I don't make many tuts these days.

~Raffeh

Lars
01-02-2008, 02:34 AM
Easy and fast, I like it.

Thanks for the share

alphastickmania
01-02-2008, 02:37 AM
Ok... Doesn't look too shabby but it isn't as complex as you say it is. No... wait. This is actually more simple then the basic stuff for actionscript I have seen so this tutorial would go well with beginners who would like a try at basic (Very basic) flash game creation. Btw, haven't tried your tutorial yet, ain't going to.

:Smile:

Raffi
01-02-2008, 02:41 AM
Easy and fast, I like it.

Thanks for the share
Thanks :3

Ok... Doesn't look too shabby but it isn't as complex as you say it is.
How do I make it look complex?
No... wait. This is actually more simple then the basic stuff for actionscript I have seen so this tutorial would go well with beginners who would like a try at basic (Very basic) flash game creation.
Rly?
Btw, haven't tried your tutorial yet, ain't going to.
>_>
:Smile:

alphastickmania
01-02-2008, 02:55 AM
Ok... Doesn't look too shabby but it isn't as complex as you say it is.
How do I make it look complex?
No... wait. This is actually more simple then the basic stuff for actionscript I have seen so this tutorial would go well with beginners who would like a try at basic (Very basic) flash game creation.
Rly?
Btw, haven't tried your tutorial yet, ain't going to.
>_>
:Smile:



Answer to the first Qns : No. You can't. Wait till you see a file filled with purely actionscript.

Answer to the second Qns : Yes, really. You are doing a big favor for any beginners out there.

Answer to the third Qns : I have my hands tied with a Flash scroll bar. (Pun Intended) Actually, besides that, I have seen a slightly more complicated scoring system. Nothing to say about the movement scripts though.

Raffi
01-02-2008, 03:00 AM
Answer to the first Qns : No. You can't. Wait till you see a file filled with purely actionscript.
Hang on, you said 'Its's not as complex as you make it look' And now your saying i can't make it look more complex.
Answer to the second Qns : Yes, really. You are doing a big favor for any beginners out there.
Thanks :3
Answer to the third Qns : I have my hands tied with a Flash scroll bar. (Pun Intended)
I don't get it.
Actually, besides that, I have seen a slightly more complicated scoring system. Nothing to say about the movement scripts though.
It's a simple scoring system for noobs.
. .

alphastickmania
01-02-2008, 03:34 AM
.Hang on, you said 'Its's not as complex as you make it look' And now your saying i can't make it look more complex.

Ans : I said "as you say it is", not "as you make it look". On a serious note, it is definitely not as complex as YOU said it is. That's why I added that you can't make it anymore complex in case you weren't clear. I am only re-enforcing my earlier statement. Do you not comprehend? .

It's a simple scoring system for noobs.

Ans : It is as you say. It is a scoring system for "noobs". How complex can it get?

End Day Message : Your point was?

Raffi
01-02-2008, 07:32 AM
End Day Message : Your point was?
My point is to answer the million questions your throwing at me.

Just stop before a flame war starts.

blueguy910
01-02-2008, 02:08 PM
actionscript errors noo what the ********************************************

Paco
01-02-2008, 02:11 PM
Okay, this is pretty complex, but here goes. This tut is to make one of those games where guys run along and you click on them to shoot and kill them!
i have to disagree

i think to make it more complex by adding some things like-
enemys take more than 1 hit to kill,
somthing to defend
health for ^^^^

but overal good tutorial.

leo4life
01-17-2008, 07:48 PM
how do i put a keyfram inside a movieclip?

Myself
01-18-2008, 08:16 PM
I find ir easyer to jsut use the old buttion method.

Mesmay
03-20-2008, 02:18 PM
Its ok i guess.
It can only be SO good, because its a very basic concept.

Raffi
03-21-2008, 12:58 PM
Old thread is old, much?

Thanks for the comments anyway.