ForumsProgramming ForumTUTORIAL: Your First Game ( Learn The Basics )

96 55015
Dannydaninja
offline
Dannydaninja
948 posts
Nomad

This is a little Tutorial i made for any people who just got there hands on Flash and want to make a game. The Tutorial is divided into five parts. This will teach you the basics for Adobe Flash CS4

PART ONE

1. Go to top left corner of the screen and click on File

2. Lots of options will pour down, at the very top is " New... "

3. Now you can make a new document. Select "Flash File (ActionScript 2.0"


PART TWO

4. Now go at the top left corner of the screen and you'll see new, go a bit left and you'll find " Modify " click on " Modify "

5. At the top of those options is " Document... " click on that.

6.see the dimensions there at the top? now you can adjust the width and height of the document!! Put in " 700 px " for width and " 500 px " for height then press ok

7. Ta-da! you have now learnt how to make the size of your game.

PART THREE

8. Now on your right side ( maybe not but probably ) you'll see your selection of drawing tools. So draw something ( make sure it doesn't take up the entire screen!! ). I Drew a Red Square :P

http://i939.photobucket.com/albums/ad238/DannyDaNinja/lalaal.jpg?t=1270822048

9. Get your Section Tool ( black cursor in drawing tools )
( PRESS V FOR SHORTCUT! ) and select your entire drawing.

10. Go to Modify ( see step 4 if you get lost! ) and select " Convert to symbol ".

11. Name the Symbol "Drawing" And press OK.

PART FOUR

12. Now things get hard, Coding the game. Learning code is hard so i highly suggest you just copy and paste the code i show.

13. Select your drawing and you'll see it's " Properties ".

14. You'll see some changable text called " <Instance Name> " change that text to " Drawing "

15. Now select your drawing and press F9 to open it's actions, this is where the code is inputed

16. Enter paste the following code:

*************************************
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x--;
}
if (Key.isDown(Key.RIGHT)) {
_x++;
}
if (Key.isDown(Key.UP)) {
_y--;
}
if (Key.isDown(Key.DOWN)) {
_y++;
}
}
*************************************


17. Great! Now press Ctrl + Enter
( like you should press Crtrl Alt Delete )

18. Now you can move your drawing around using the arrow keys!


PART FIVE ( OPTIONAL )

19. This is just an optional part for anyone who wants to learn a bit more helpful code....

20. Your Drawing is going too slow isn't it? Select your drawing, press F9 and enter in this code:

******************************
onClipEvent (load) {
power = 3;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= power;
}
if (Key.isDown(Key.RIGHT)) {
_x += power;
}
if (Key.isDown(Key.UP)) {
_y -= power;
}
if (Key.isDown(Key.DOWN)) {
_y += power;
}
}
******************************

21. Now press Ctrl + Enter and you'll see that your drawing is moving faster!! But how? At the top of the code i just gave you, you'll see i added a variable to input the speed of which the instance moves.

22. Now Change the power to 5, by replacing the 3 in the code i just gave you 2 steps ago.

23. Congratz you have now learnt how to mod the speed of your drawing. Try '20' for extreme speed



____________________________________________________________

Congratulations! You have passed this tutorial if you managed to complete all the steps! This was a tutorial made by an newbie flash game developer so dont think your a sucky at flash if you get confused or lost, it's my fault not yours!!

By finishing this tutorial you have learnt the raw basics which include:

* Making A New File
* Changing The Game Size Of Your Game
* Drawing Objects
* Converting Drawings into Symbols
* How To Name Objects
* How To Make Basic Movement Code
* How To Change The Speed In The Basic Movement Code ( if you did part 5 )

I hope this could help even 1 person who needed it. NOW GIVE ME FEEDBACK!!! :P


____________________________________________________________

  • 96 Replies
Glazastik
offline
Glazastik
10 posts
Nomad

I got it all working now, thanks.

Dannydaninja
offline
Dannydaninja
948 posts
Nomad

So Glazastik how is the Tutorial going? is it confusing!?

Glazastik
offline
Glazastik
10 posts
Nomad

Was a bit confusing, since I have another OS and language, but I managed to find it. I never found 14 but it works anyway. It was simple, I liked it, good job.

manny6574
offline
manny6574
922 posts
Nomad

as3 and as2 are extremely similar


suprisingly close to being not so similar though
[quote]Umm.. I somehow find as3 waaaay more easy to understand (and organized)
Sure it's more organized but i find AS2 Easier to "LEARN"[/quote]

by understand I mean learn sorry!
rjbman
offline
rjbman
215 posts
Nomad

Glazastik, as long as it works it doesn't matter, in my opinion.

Who needs clean text when you're finished programming?

Dannydaninja
offline
Dannydaninja
948 posts
Nomad

Hey as long as i could help one person i'm happy.

plasmafish
offline
plasmafish
252 posts
Nomad

Games have things like start screens, score, enemies, and levels also right?

I would not consider this a game at all. More like a way to move a block around the screen. Yes, it is the simplest "framework" of a game possible in flash, but if you don't know what else to do your pretty much screwed.

Darkroot
offline
Darkroot
2,763 posts
Peasant

@plasmafish

And your going to be the first one to write an entire game then tutorialize it for us? If you do please include a highly dynamic physics engine that you made and then explain to how you made it. Also include a water animated loader. But the waves are controlled by actioscript. Don't use sin because it doesn't look realistic enough use naiver strokes equation. I also need to brush up on my drawing API and Paper-vision so those would be much appreciated too.

Seriously harsh comment to someone who is just doing basics like complete basics. This isn't advanced cryptosystems and advanced ai training here.

Dannydaninja
offline
Dannydaninja
948 posts
Nomad

@plasmafish

I thought the noobs should just learn how to learn the Raw Basics. Plus i didn't want it to be to long because i know that long tutorials are quite taunting to newbies.

plasmafish
offline
plasmafish
252 posts
Nomad

Dark, sorry I hurt your feelings. Just thought this wasn't a good tutorial because I've seen it a ton of times on this site and it sucks. I used a game engine tutorial and made my first game, but I don't see this helpful to people trying to actually create a game. I don't sit by idle and congratulate people who do sub par work. Danny can do a much better tutorial than this I thought.


Danny, I am just pointing out that this is more along the lines of controlling a movie clip than a game as you called it. Making a long tutorial with a lot of information in it just stops the 'newbies' from trying to do something they didn't want to do in the first place. Longer, more thought out tutorials are recommended because this information you posted is almost rudimentary.

Danny does this constitute a tutorial?

onClipEvent (load) {
speed = 0;
maxmove = 15;
}
onClipEvent (enterFrame) {
if (_root.dead) {
this.gotoAndStop("dead&quot;
} else {
speed *= .85;
if (speed>0) {
dir = "right";
} else if (speed<0) {
dir = "left";
}
if (dir == "right&quot{
this._x += speed;
_root._x -= speed;
}
if (dir == "left&quot {
this._x += speed;
_root._x -= speed;
}
if (Key.isDown(Key.LEFT)) {
if (speed>-maxmove) {
speed--;
}
this.gotoAndStop("run&quot;
this._xscale = -100;
} else if (Key.isDown(Key.RIGHT)) {
if (speed<maxmove) {
speed++;
}
this._xscale = 100;
this.gotoAndStop("run&quot;
}
if (speed<1 && speed>-1 && !attacking) {
speed = 0;
this.gotoAndStop("idle&quot;
}
}
}

Gravity and Jumping
Next up we need jumping. This code will give you jumping; it would be inserted after the other key.isDown events:
if (speed<1 && speed>-1 && !attacking) {
speed = 0;
this.gotoAndStop("idle&quot;
}
if (Key.isDown(Key.UP) && !jumping) {
jumping = true;
}
if (jumping) {
this.gotoAndStop("jump&quot;
this._y -= jump;
jump -= .5;
if (jump<0) {
falling = true;
}
if (jump<-15) {
jump = -15;
}
}

plasmafish
offline
plasmafish
252 posts
Nomad

And try to post a .FLA next time.

Kirupa Platform Game Engine Code

Darkroot
offline
Darkroot
2,763 posts
Peasant

Dark, sorry I hurt your feelings.


Lol

Just thought this wasn't a good tutorial because I've seen it a ton of times on this site and it sucks.


Of course what age range is this site targeting uhhh... 13-16. I think it's self explanatory why there not that good.
Dannydaninja
offline
Dannydaninja
948 posts
Nomad

Of course what age range is this site targeting uhhh... 13-16


Completely disagree. Most people who play on this site are under 13. But most of em dont become members or dont go on the fourms. Trust me.
Dannydaninja
offline
Dannydaninja
948 posts
Nomad

oh and plasma, nice little game you go there... you made it yourself right?

plasmafish
offline
plasmafish
252 posts
Nomad

oh and plasma, nice little game you go there... you made it yourself right?


Yes, I made the game from this tutorial. I don't make games though, Super Mitchio was my first attempt at a game.
Showing 16-30 of 96