| |
AS3 OOP game
tutorial
Written by Stephan Meesters
In this tutorial we will be creating a mouse/shooting game of intermediate difficulty. Basic OOP concepts will be explained as well as some higher-level coding techniques. It has got the structure that would work on most kind of flash games. It is adviced to keep the source code next to you when reading the tutorial, because not every bit is explained.
The graphics for the player consists of a simple circle with a line attached to it, that rotates according to the mouse movement. Red balls come in a random wave manner and shooting them gives the player points. Touching a red ball will decrease your health.
The PDF version of the tutorial is available here:
www.keepsake-games.com/games/gametutorial/as3gametutorial.pdf
The source code is available here:
www.keepsake-games.com/games/gametutorial/source.zip
In case you are using this code to create your own game, please add my name to the credits.

next page
Comments
deepika
19 Nov 2009, 08:43
i want to understand the procedure of making this game
PeterMilko
23 Nov 2009, 02:18
i will try to make it panicpop.com
jack
23 Nov 2009, 18:50
thx to u tutorial
this is great ^.^
hope u can make more function to this
aasim
08 Dec 2009, 22:10
Thank you for help me
PageMaker
10 Dec 2009, 18:00
Nice tut indeed!
It would be nice to have comments and explanations in the coding flow;
that's good for learning not good for performance - but who will need in
this stage of development.
arun
11 Dec 2009, 11:53
I need tutorials
avnish kumar
12 Dec 2009, 19:04
i want to make flash game, but i don't know what i will do?
nirbhay
15 Dec 2009, 07:07
very helpful, thank you.
nirbhay
15 Dec 2009, 08:09
just had to leave another comment.
very nicely explained. i was looking for studd like this for a long time.
olamide
09 Jan 2010, 16:56
pls help with this part of my life because no one wants me and to this is
the only way i could come great in life pls do help me. for this is not
just help by giving some person a book but building the life of some body
pls consider and get me the best gaming book of all
olamide
09 Jan 2010, 17:00
i want to know how to creat games using flash
rimby4
17 Jan 2010, 10:55
can you make more games?
Timmeh
17 Jan 2010, 18:22
it think... its a great tutorial BUT i dont know for sure where to place
the code... the first code segment is simple just in gameBasis.as but where
in gameBasis.as do you have to put the other segments?
greetz.
Keepsake Games
18 Jan 2010, 18:52
Hi Timmy, it's adviced to download the source code of the game (available
at the top of this page), open up the .as files and look where all the bits
of code are placed. The tutorial merely explains what the code does.
gg
24 Jan 2010, 17:15
Very useful tutorial, thanks a lot.
Goh Wei Choon
28 Jan 2010, 04:35
Hey, I'm new to the web design industry, and am especially fascinated in
learning AS3. This article has been incredibly helpful, for I find that the
best way to learn such design applications are step-by-step guides such as
this; we all learn well by doing.
Thanks a lot for this! I particularly enjoyed creating this game myself
with my own variable names and such.
I think it would be a lot more helpful if you had gone more into detail
about the syntax and such. I had to do a lot of referencing elsewhere to
fully understand the coding.
But all-in-all a very interesting and enjoyable tutorial.
Froob
02 Feb 2010, 21:26
Nice tutorial. keep up the good work
Vinicius
01 Mar 2010, 03:32
Very good. A great tutorial.
I make some changes in the game. I change the shoot event to MOUSE_MOVE.
The enemy speedy was elevated to 8 And I make the game launch 15 enemy
waves in the same time.
Bret Morretti
01 Mar 2010, 05:02
Hey this is a great Tut. Is there any chance you can make a tut for a spot
the difference game? I'll Pay!
RAJ
15 Mar 2010, 07:09
NICE
ashwin
31 Mar 2010, 16:04
mnice
Pim
12 Apr 2010, 20:55
Stephan, je bent awesome.
benji
23 May 2010, 18:29
Hi Stephan. Appreciate it if you can upload the source files again. I'm
trying out the tutorial, but am getting nowhere without the referencing the
actual files.
Appreciate it and Thanks.
jackiieee
18 Jul 2010, 14:13
please help me,
i made a player that is bigger than the normal player, but if the enemys go
over my player my player isn't hurt, except if the enemy was straight in
the middle, how do i increase the region of my player where he can be hit
tnx
ps i'm sorry for my english but i'm dutch
Keepsake
24 Jul 2010, 22:51
@jackie
This part of the code inside the Update function of initGame.as is
responsible for the distance check with the player to enemy. You have to
change 150 to something larger.
if( (ob.x-p.x)*(ob.x-p.x) + (ob.y-p.y)*(ob.y-p.y) < 150 ){ ... }
|
|