Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
15Activity
0 of .
Results for:
No results containing your search query
P. 1
Create a Simple Shooting Game in Flash AS3 (Tutorial)

Create a Simple Shooting Game in Flash AS3 (Tutorial)

Ratings: (0)|Views: 4,686 |Likes:
Published by em
A straightforward guide to creating a simple shooting game in AS3. Everything you need to know to get you started off in Flash game development. A step-by-step guide with the complete code for the game.
A straightforward guide to creating a simple shooting game in AS3. Everything you need to know to get you started off in Flash game development. A step-by-step guide with the complete code for the game.

More info:

Published by: em on Dec 10, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

06/08/2013

pdf

text

original

 
 
Tutorial on Creating aSimple Shooting Game inFlash AS3
www.flashbynight.com
 
Creating a
 
Simple Shooting Game in Flash
 
Actionscript 3
 
What you will learn:
 
 
how to build a simple shooting game using Flash AS3
 
how to build functions and classes commonly used in game design
 
how to create a game loop
 
how to control and animate objects onscreen
Prerequisites:
 
 
working copy of Flash CS4 or above
 
working knowledge of how to use the Flash interface
 
basic knowledge of AS3
 
knowledge of document classes (link given below)
Goal
 We are going to make a simple shooting game using Flash Actionscript 3 (AS3). At the end of thistutorial, you will have a working game that you can use and customize as you wish. The completedcode is given at the end of this document. The game that we are going to design is a very simpleshooting game; the goal is to quickly learn the minimum that you need to know to get you startedin game design in Flash. Along the way, we’ll cover some tips and techniques that will help you tounderstand more about the process of game design.You can see an example of the finished game here:http://flashbynight.com/tutes/simplegame/game.html If you’d like to download the completed project, you can do so at:http://flashbynight.com/tutes/simplegame/game.zip 
Step 1
The first step is to prepare the basic documents that we will need. We need to create a Flash filenamed Game.fla and we need to create a document class called Game.as, where we will hold mostof our code. We will create one other .as file as we work through the tutorial, but we’ll discussthat later.*If you are unfamiliar with document classes, there is a quick guide here:http://www.flashbynight.com/tutes/doc_classOnce you have done this, proceed with step 2.
Step 2
OK, we’re going to need to set up our .fla file and add some graphics. Our .fla file, Game.fla, willonly require one blank frame, believe it or not. Everything in the game will be added dynamicallyand removed when it is no longer needed. We do not put any code in the main timeline. All thecode will be in Game.as, where we can find it easily. (
 Almost
all the code, but more about thatlater.)We do want to have a black background for the .fla file (since it is a ‘space’ shooter). And we needto set the frame rate to 35 fps, which will help the motion to look smooth to the human eye. Mostgames are set somewhere between 25 – 35 fps. Lower than this and the motion will seem jerky. Todo this, use CTRL+J and a dialog box will appear. We also need to set the Flash document size to:
 
Width – 800 and Height – 600. This makes the movie nice and big, but it will fit into most laptopscreens without scrolling.
Step 3
Now, your blank document class (Game.as) should look like this (note that capitalisation counts inFlash):
package {import flash.display.MovieClip;public class Game extends MovieClip {public function Game() {// constructor code}}}
What we want to do next is to put the framework of the game into place. Here we go:
package {import flash.display.MovieClip;import flash.utils.Timer;import flash.events.TimerEvent;import flash.events.KeyboardEvent;import flash.events.MouseEvent;public class Game extends MovieClip {//common//assets//variables//arrayspublic function Game() {}//gamepublic function startscreen(){}//sscreenpublic function SetUp(){

Activity (15)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
manindarkumar liked this
papdpan liked this
Jo Burrows liked this
Chaulina Allena liked this
Chaulina Allena liked this
Exoro Choice liked this
Nabil Tanjawi liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->