SlideShare ist ein Scribd-Unternehmen logo
1 von 11
Downloaden Sie, um offline zu lesen
DPP B2 (c)




                                       JOB SHEET

COURSE :               DIPLOMA IN DIGITAL MEDIA DESIGN

SESSION :              JAN - JUN 2012                               SEMESTER :         4

CODE/SUBJECT :         DDM 4323 - GAME DESIGN                       SHEET NO :         JS-8
NO OF STUDENTS :       30                                           WEEK :             8
LECTURER :             AZMI BIN MOHAMED


TOPIC :                8.0     SPACE SHOOTER

                             8.1   Research and create a basics of movie clips and character
                                   movement for space shooter game
SUB-TOPIC :
                             8.2   Add an interactive elements; lives and score for game
                             8.3   Add sound effects using ActionScript.


                       After completing this topic, students should be able to:
LEARNING                     1. Develop their own space shooter games with random enemies.
OUTCOME :                    2. Create an interactive element; lives and score for their games.
                             3. Add a sound effects using ActionScript



TOOLS /                      1. Computer
EQUIPMENTS /                 2. Projector
MATERIALS :                  3. Adobe Flash CS4




INSTRUCTION :

   1. Research the ActionScript for creates a space shooter game, character movement and
      shoot control using keyboard.
   2. Follow step-by-step tutorial below to create a space shooter game.




                                                                                       Page | 1
DPP B2 (c)


PROCEDURE :
STEP                                              KEY POINT

Movie Clip and Movement

1. Open Adobe Flash and create new
   document (ActionScript 2.0)

        Size: 800x600px
        Frame Rate : 24fps
        Background Color: Black


2. Create a Movie Clip by right clicking your
   library tab and selecting "New
   Symbol...", make sure "Movie Clip" is
   selected and choose a name.




3. Flash will create and open the Movie
   Clip for editing, so just paste an image or
   draw a space ship with Flash's drawing
   tools. After drawing your ship, get back
   to the main timeline by click on "Scene
   1":


    At properties panel; put a variable name
    as “ship”.




4. Right click the first frame in your timeline   this.onEnterFrame = function()
   and select "Actions". Type this:               {
                                                        if (Key.isDown(Key.RIGHT))
                                                        {
                                                              Ship._x += 10;
                                                        } else if (Key.isDown(Key.LEFT))
                                                        {
                                                              Ship._x -= 10;
                                                        } else if (Key.isDown(Key.UP))
                                                        {
                                                              Ship._y -= 10;
                                                        } else if (Key.isDown(Key.DOWN))
                                                        {
                                                              Ship._y += 10;
                                                        }
                                                  }




                                                                                  Page | 2
DPP B2 (c)



Shooting

5. This is the second part of the tutorial
   and we are going to enable the ship to
   shoot. Previously we made our ship fly;
   now we are going to make it shoot and
   set limits to where it can go.

   First we need to make our bullets, right
   click the library tab, select "New
   Symbol" and give it the name "Bullet".

   Before clicking OK, click Advanced,
   select "Export for Actionscript" and
   make sure the identifier is "Bullet".



6. We do this because we need to export
   the Bullet Movie Clip during running time
   to create many bullets and we will use
   the name determined in identifier to call
   it later. Draw a small bullet, and position
   it like this:

   This is called registration point, in the
   stage this is the position of the Bullet
   Movie Clip.




7. Now open the actions window of the first      this.onEnterFrame = function()
   frame of the Movie Clip, insert this code:    {
                                                      this._x += 12;
                                                      if (this._x > 800)
                                                      {
                                                            this.removeMovieClip();
                                                      }
                                                 }


8. Now go to the main timeline, select the       var i = 0;
   first frame and open the actions              this.onEnterFrame = function()
                                                 {
   windows. You will see the previous
                                                       .
   codes that we have written. Add this                .
   code to the old one so we can fire our              .
   bullets:                                            else if (Key.isDown(Key.DOWN))
                                                     {
                                                         Ship._y += 5;
                                                       }
                                                       if (Key.isDown(Key.SPACE))



                                                                                  Page | 3
DPP B2 (c)

                                                    {
                                                          i++;
                                                        _root.attachMovie("Bullet",
                                                        "Bullet" + i,
                                                        _root.getNextHighestDepth());
                                                        _root["Bullet" + i]._x =
                                                        Ship._x + 3;
                                                        _root["Bullet" + i]._y =
                                                        Ship._y;
                                                    }
                                               }



9. Before we finish this tutorial, let's put   if (Key.isDown(Key.RIGHT))
   some limits to where our ship can go, we    {
   don't want it to get off the screen. Make         if (Ship.hitTest(800, Ship._y,
   these changes:                                    true))
                                                     {
                                                           Ship._x -= 5;
                                                     }
                                                     Ship._x += 5;
                                               } else if (Key.isDown(Key.LEFT))
                                               {
                                                     if (Ship.hitTest(0, Ship._y,
                                                     true))
                                                     {
                                                           Ship._x += 5;
                                                     }
                                                     Ship._x -= 5;
                                               } else if (Key.isDown(Key.UP))
                                               {
                                                     if (Ship.hitTest(Ship._x - 40, 0,
                                                     true))
                                                     {
                                                           Ship._y += 5;
                                                     }
                                                     Ship._y -= 5;
                                               } else if (Key.isDown(Key.DOWN))
                                               {
                                                     if (Ship.hitTest(Ship._x - 40,
                                                     600, true))
                                                     {
                                                           Ship._y -= 5;
                                                     }
                                                     Ship._y += 5;
                                               }

                                               if (Ship.hitTest(800, Ship._y, true))
                                               {
                                                     Ship._x -= 5;
                                               }




                                                                               Page | 4
DPP B2 (c)



Enemies

10. This is the third tutorial of a series about
    developing a Space Shooter game, in
    this tutorial we are going to make enemy
    ships.

    Create a new Movie Clip and draw your
    enemy ship, don't forget to set the
    identifier to "Enemy" and select "Export
    to Actionscript".




11. Now drag the enemy Movie Clip to the           onClipEvent(load)
    stage, give it an instance name of             {
    "Enemy0", right click it and select                   function reset()
    "Actions". Insert this:
                                                          {
                                                              var timer = 12;
                                                              this._y = Math.random() * 300
                                                              this._x = 550
                                                              mySpeed = Math.ceil(Math.
                                                               random() * 6) + 1;
                                                          }
                                                          reset();
                                                   }


                                                   // This part of the code creates a function called
                                                   reset() when the Movie Clip loads for the first
                                                   time. Inside reset() we set this._y to a random
                                                   number between 0 and 600, this._x to 800 and
                                                   the speed of our enemy to a random number
                                                   between 1 and 6.



12. Then, insert this code:                        onClipEvent(enterFrame)
                                                   {

                                                          this._x -= mySpeed;
                                                          if (this._x < -10)
                                                          {
                                                                reset();
                                                          }

                                                          if (timer >= 12)
                                                          {

                                                              Math.ceil(Math.random() * 2)
                                                              timer = 0;



                                                                                            Page | 5
DPP B2 (c)

                                                       }
                                                       if (dir == 1)
                                                       {
                                                             this._y -= 3;
                                                       } else if(dir == 2)
                                                       {
                                                             this._y += 3;
                                                       }
                                                       timer++
                                                }



13. Add this code in the main timeline before   var nrEnemies = 3;
    the rest of the code.                       for (i = 1; i < nrEnemies; i++)
                                                {
                                                      _root.Enemy.duplicateMovieClip
                                                      ("Enemy" + i,
                                                      _root.getNextHighestDepth());
                                                }


Lives and Score

14. This is the forth part of the development
    of a Space Shooter game. In this tutorial
    we will add lives, scores and game over
    to our game.

    Let's start with score.Open the main
    timeline code and add this variable:        var score = 0;


15. Now open the Bullet's code and add this:    this.onEnterFrame = function()
                                                {
                                                      this._x += 9;
                                                      if (this._x > 550)
                                                      {
                                                            this.removeMovieClip();
                                                      }
                                                      for (i = 0; i < _root.nrEnemies;
                                                           i++)
                                                      {
                                                            if (this.hitTest
                                                               (_root["Enemy" + i]))
                                                            {
                                                            _root["Enemy" + i].reset();
                                                            _root.score += 10;

                                                       this.removeMovieClip();
                                                             }
                                                       }
                                                }

                                                // This is the code we used before to know if a
                                                bullet hits an enemy, so we can put the score
                                                for killing an enemy there.




                                                                                        Page | 6
DPP B2 (c)



16. The score is done; we just need to show
    the player his score. To do that, select
    the Text Tool and draw it on the stage.

   Write "Score:"




17. Now draw another Text box on the
    stage. Select this new Text box and
    change these properties:




18. Now let's make our ship have lives. Add     var lives = 3;
    another variable in the main code:

19. And make these changes in the code          if (this.hitTest(_root["Enemy" + i]))
    that checks if the player crashed with an   {
                                                      _root.lives -= 1;
    enemy:
                                                      reset()
                                                      for(k = 0; k < _root.nrEnemies;
                                                          k++)
                                                      {
                                                            _root["Enemy" + k].reset();
                                                      }
                                                }




                                                                                Page | 7
DPP B2 (c)



20. Draw two text boxes again




21. We can see the ship losing lives now,
    but nothing happens when it goes lower
    than zero. To change that we tell the
    player when its game over. Create a new
    movie clip.




22. Write "Game Over" using the text tool
    and go back to the main timeline.




                                              Page | 8
DPP B2 (c)



23. Add this to the Ship's code:               if (this.hitTest(_root["Enemy" + i]))
                                               {
                                                     _root.lives -= 1;
                                                     if (_root.lives <= 0)
                                                     {
                                                     _root.attachMovie("GameOver",
                                                     "GameOver", 100)
                                                     _root.GameOver._x = 275
                                                     _root.GameOver._y = 150
                                                     this.swapDepths(10);
                                                     this.removeMovieClip();
                                                     }
                                                     reset()
                                                     for(k = 0; k < _root.nrEnemies;
                                                         k++)
                                                     {
                                                           _root["Enemy" + k].reset();
                                                     }
                                               }


Timer

24. Before we start with sound we need to
    make some changes. You may have
    noticed that our ship shoots bullets as
    much as the player press the space bar,
    that's not right as it makes the game
    much easier.
    To prevent that, we are going to add a
    timer and the ship will shoot as much as
    we want.

   First add a new variable:                   var timer = 8;

   Then, make this changes:                    this.onEnterFrame = function()
                                               {
                                                     timer++;
                                                     .
                                                     .     .
                                                     if (Key.isDown(Key.SPACE))
                                                     {
                                                           i++;
                                                           if(timer >= 8)
                                                           {
                                                     _root.attachMovie("Bullet",
                                                     "Bullet" + i,
                                                     _root.getNextHighestDepth());
                                                     _root["Bullet" + i]._x =
                                                     Ship._x + 3;
                                                     _root["Bullet" + i]._y = Ship._y;
                                                           timer = 0;
                                                           }
                                                     }
                                               }



                                                                               Page | 9
DPP B2 (c)



The code runs like this:                          Before:

    If timer >= 8 then shoot a bullet and set
     timer to 0
    Now that timer = 0, the bullet wont shoot,
     so the player has to wait all the code to
     run at least 8 timer to shoot again
     (timer++ will increase timer by 1 every
     frame)
    Timer will be bigger than 8 again and the
     player can shoot.




                                                  After:




Sound

 25. We can add the sound now. You need to
     have an mp3 file that's going to be the
     sound played when you fire. Now that
     you have your sound, click File > Import
     > Import to library...Select your mp3 file
     and click open, a new file should appear
     on the library. Right click it and click
     "Linkage..." Check "Export to
     ActionScript..." and set the Identifier to
     "shoot". This is the same thing we did
     previously with the Bullet Movie Clip, we
     need the linkage to call this on the code.




                                                            Page | 10
DPP B2 (c)



26. Add this to the shooting code:               if (Key.isDown(Key.SPACE))
                                                 {
                                                       i++;
                                                       if(timer >= 8)
                                                       {
                                                       _root.attachMovie("Bullet",
                                                       "Bullet" + i,
                                                       _root.getNextHighestDepth());
                                                       _root["Bullet" + i]._x = Ship._x
                                                       + 3;
                                                       _root["Bullet" + i]._y = Ship._y;

                                                         var shoot_sound = new Sound();
                                                         shoot_sound.attachSound("shoot");
                                                         shoot_sound.start();
                                                         timer = 0;
                                                         }
                                                 }



27. The game is done! Hope you enjoying
    developing and playing it.




REFERENCES :                         1. Andrew Rollings, Ernest Adams (2003). Andrew Rollings and
                                        Ernest Adams on Game Design. USA: New Riders
                                        Publishing.
                                     2. Andrew Rollings, Dave Morris (2004). Game Architecture and
                                        Design:A New Edition. USA: New Riders Publishing.
                                     3. Patrick O’luanaigh (2006). Game Design Complete. USA:
                                        Paraglyph Press.




                                                                                         Page | 11

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction à dart
Introduction à dartIntroduction à dart
Introduction à dartyohanbeschi
 
Design pattern - part 1
Design pattern - part 1Design pattern - part 1
Design pattern - part 1Jieyi Wu
 
[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancji[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancjiJakub Marchwicki
 
Writing a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 CanvasWriting a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 CanvasSteve Purkis
 
Zend Framework 1 + Doctrine 2
Zend Framework 1 + Doctrine 2Zend Framework 1 + Doctrine 2
Zend Framework 1 + Doctrine 2Ralph Schindler
 
C++ prgms 4th unit Inheritance
C++ prgms 4th unit InheritanceC++ prgms 4th unit Inheritance
C++ prgms 4th unit InheritanceAnanda Kumar HN
 
enchant js workshop on Calpoly
enchant js workshop  on Calpolyenchant js workshop  on Calpoly
enchant js workshop on CalpolyRyo Shimizu
 
C++ prgms 5th unit (inheritance ii)
C++ prgms 5th unit (inheritance ii)C++ prgms 5th unit (inheritance ii)
C++ prgms 5th unit (inheritance ii)Ananda Kumar HN
 
38 object-concepts (1)
38 object-concepts (1)38 object-concepts (1)
38 object-concepts (1)Shambhavi Vats
 

Was ist angesagt? (15)

Vaadin7
Vaadin7Vaadin7
Vaadin7
 
Introduction à dart
Introduction à dartIntroduction à dart
Introduction à dart
 
ExtJS framework
ExtJS frameworkExtJS framework
ExtJS framework
 
Vaadin 7
Vaadin 7Vaadin 7
Vaadin 7
 
Design pattern - part 1
Design pattern - part 1Design pattern - part 1
Design pattern - part 1
 
[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancji[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancji
 
Writing a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 CanvasWriting a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 Canvas
 
Zend Framework 1 + Doctrine 2
Zend Framework 1 + Doctrine 2Zend Framework 1 + Doctrine 2
Zend Framework 1 + Doctrine 2
 
C++ prgms 4th unit Inheritance
C++ prgms 4th unit InheritanceC++ prgms 4th unit Inheritance
C++ prgms 4th unit Inheritance
 
Eclipse Banking Day
Eclipse Banking DayEclipse Banking Day
Eclipse Banking Day
 
enchant js workshop on Calpoly
enchant js workshop  on Calpolyenchant js workshop  on Calpoly
enchant js workshop on Calpoly
 
OOPS
OOPSOOPS
OOPS
 
C++ prgms 5th unit (inheritance ii)
C++ prgms 5th unit (inheritance ii)C++ prgms 5th unit (inheritance ii)
C++ prgms 5th unit (inheritance ii)
 
Games 3 dl4-example
Games 3 dl4-exampleGames 3 dl4-example
Games 3 dl4-example
 
38 object-concepts (1)
38 object-concepts (1)38 object-concepts (1)
38 object-concepts (1)
 

Andere mochten auch

20120620「ココナラ×ワールドカフェ」プレゼン資料
20120620「ココナラ×ワールドカフェ」プレゼン資料20120620「ココナラ×ワールドカフェ」プレゼン資料
20120620「ココナラ×ワールドカフェ」プレゼン資料coconala
 
20120731プレゼン資料
20120731プレゼン資料 20120731プレゼン資料
20120731プレゼン資料 coconala
 
Prezentace qt filemanager
Prezentace qt filemanagerPrezentace qt filemanager
Prezentace qt filemanagertomaslucovic
 
Prepositions of time
Prepositions of timePrepositions of time
Prepositions of timeCJessica
 
Video Audio Lab
Video Audio LabVideo Audio Lab
Video Audio LabZai Lekir
 
What Photography Experts Said About Photography : Photography quotes
What Photography Experts Said About Photography : Photography quotesWhat Photography Experts Said About Photography : Photography quotes
What Photography Experts Said About Photography : Photography quotesPicBackMan
 
Action and Adventure Games
Action and Adventure GamesAction and Adventure Games
Action and Adventure GamesZai Lekir
 
Did You Know These Photography Facts?
Did You Know These Photography Facts?Did You Know These Photography Facts?
Did You Know These Photography Facts?PicBackMan
 
Introduction to the Digital Typography
Introduction to the Digital TypographyIntroduction to the Digital Typography
Introduction to the Digital TypographyZai Lekir
 
Redmineをつかったスクラム開発のはじめの一歩
Redmineをつかったスクラム開発のはじめの一歩Redmineをつかったスクラム開発のはじめの一歩
Redmineをつかったスクラム開発のはじめの一歩kiita312
 

Andere mochten auch (16)

The Gospel
The GospelThe Gospel
The Gospel
 
20120620「ココナラ×ワールドカフェ」プレゼン資料
20120620「ココナラ×ワールドカフェ」プレゼン資料20120620「ココナラ×ワールドカフェ」プレゼン資料
20120620「ココナラ×ワールドカフェ」プレゼン資料
 
Typo lab
Typo labTypo lab
Typo lab
 
20120731プレゼン資料
20120731プレゼン資料 20120731プレゼン資料
20120731プレゼン資料
 
Prezentace qt filemanager
Prezentace qt filemanagerPrezentace qt filemanager
Prezentace qt filemanager
 
Prepositions of time
Prepositions of timePrepositions of time
Prepositions of time
 
Video Audio Lab
Video Audio LabVideo Audio Lab
Video Audio Lab
 
คำคมอารมปราชน์
คำคมอารมปราชน์คำคมอารมปราชน์
คำคมอารมปราชน์
 
Time sheet
Time sheetTime sheet
Time sheet
 
Tour de suisse
Tour de suisseTour de suisse
Tour de suisse
 
What Photography Experts Said About Photography : Photography quotes
What Photography Experts Said About Photography : Photography quotesWhat Photography Experts Said About Photography : Photography quotes
What Photography Experts Said About Photography : Photography quotes
 
Action and Adventure Games
Action and Adventure GamesAction and Adventure Games
Action and Adventure Games
 
Did You Know These Photography Facts?
Did You Know These Photography Facts?Did You Know These Photography Facts?
Did You Know These Photography Facts?
 
Audio video
Audio videoAudio video
Audio video
 
Introduction to the Digital Typography
Introduction to the Digital TypographyIntroduction to the Digital Typography
Introduction to the Digital Typography
 
Redmineをつかったスクラム開発のはじめの一歩
Redmineをつかったスクラム開発のはじめの一歩Redmineをつかったスクラム開発のはじめの一歩
Redmineをつかったスクラム開発のはじめの一歩
 

Ähnlich wie Game Lab

Testing a 2D Platformer with Spock
Testing a 2D Platformer with SpockTesting a 2D Platformer with Spock
Testing a 2D Platformer with SpockAlexander Tarlinder
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScriptAndrew Dupont
 
HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreRemy Sharp
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconftutorialsruby
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconftutorialsruby
 
Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009Deepak Singh
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxyginecorehard_by
 
C++totural file
C++totural fileC++totural file
C++totural filehalaisumit
 
0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.doc0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.docRohanS38
 
I am sorry but my major does not cover programming in depth (ICT) an.pdf
I am sorry but my major does not cover programming in depth (ICT) an.pdfI am sorry but my major does not cover programming in depth (ICT) an.pdf
I am sorry but my major does not cover programming in depth (ICT) an.pdfseamusschwaabl99557
 
Desenvolva um game para android ou iPhone
Desenvolva um game para android ou iPhoneDesenvolva um game para android ou iPhone
Desenvolva um game para android ou iPhoneTiago Oliveira
 
2010 bb dev con
2010 bb dev con 2010 bb dev con
2010 bb dev con Eing Ong
 

Ähnlich wie Game Lab (20)

Testing a 2D Platformer with Spock
Testing a 2D Platformer with SpockTesting a 2D Platformer with Spock
Testing a 2D Platformer with Spock
 
Constructor and destructor
Constructor and destructorConstructor and destructor
Constructor and destructor
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
 
662305 11
662305 11662305 11
662305 11
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymore
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009
 
Of class1
Of class1Of class1
Of class1
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxygine
 
C++totural file
C++totural fileC++totural file
C++totural file
 
662305 LAB13
662305 LAB13662305 LAB13
662305 LAB13
 
C++ tutorial
C++ tutorialC++ tutorial
C++ tutorial
 
0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.doc0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.doc
 
Animations in Flutter
Animations in FlutterAnimations in Flutter
Animations in Flutter
 
Oojs 1.1
Oojs 1.1Oojs 1.1
Oojs 1.1
 
I am sorry but my major does not cover programming in depth (ICT) an.pdf
I am sorry but my major does not cover programming in depth (ICT) an.pdfI am sorry but my major does not cover programming in depth (ICT) an.pdf
I am sorry but my major does not cover programming in depth (ICT) an.pdf
 
Desenvolva um game para android ou iPhone
Desenvolva um game para android ou iPhoneDesenvolva um game para android ou iPhone
Desenvolva um game para android ou iPhone
 
2010 bb dev con
2010 bb dev con 2010 bb dev con
2010 bb dev con
 

Kürzlich hochgeladen

Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba Company
 
North Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full FunNorth Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full FunKomal Khan
 
fmovies-Movies hold a special place in the hearts
fmovies-Movies hold a special place in the heartsfmovies-Movies hold a special place in the hearts
fmovies-Movies hold a special place in the heartsa18205752
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Documentf4ssvxpz62
 
Call Girls Chorasi 7397865700 Ridhima Hire Me Full Night
Call Girls Chorasi 7397865700 Ridhima Hire Me Full NightCall Girls Chorasi 7397865700 Ridhima Hire Me Full Night
Call Girls Chorasi 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
Call Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call GirlsCall Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call Girlsssuser7cb4ff
 
Russian Call Girls juhu MUMBAI 00000000000000
Russian Call Girls juhu MUMBAI 00000000000000Russian Call Girls juhu MUMBAI 00000000000000
Russian Call Girls juhu MUMBAI 00000000000000Call Girls Mumbai
 
The Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty VixenThe Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty VixenSalty Vixen Stories & More
 
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...First NO1 World Amil baba in Faisalabad
 
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...Amil Baba Company
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607dollysharma2066
 
1681275559_haunting-adeline and hunting.pdf
1681275559_haunting-adeline and hunting.pdf1681275559_haunting-adeline and hunting.pdf
1681275559_haunting-adeline and hunting.pdfTanjirokamado769606
 
Call Girls Near The Corus Hotel New Delhi 9873777170
Call Girls Near The Corus Hotel New Delhi 9873777170Call Girls Near The Corus Hotel New Delhi 9873777170
Call Girls Near The Corus Hotel New Delhi 9873777170Sonam Pathan
 
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...Amil Baba Company
 
Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713Sonam Pathan
 
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts Service
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts ServiceVIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts Service
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts ServiceApsara Of India
 
Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713Sonam Pathan
 
Gripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to MissGripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to Missget joys
 
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...srsj9000
 
Call Girls CG Road 7397865700 Independent Call Girls
Call Girls CG Road 7397865700  Independent Call GirlsCall Girls CG Road 7397865700  Independent Call Girls
Call Girls CG Road 7397865700 Independent Call Girlsssuser7cb4ff
 

Kürzlich hochgeladen (20)

Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
 
North Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full FunNorth Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full Fun
 
fmovies-Movies hold a special place in the hearts
fmovies-Movies hold a special place in the heartsfmovies-Movies hold a special place in the hearts
fmovies-Movies hold a special place in the hearts
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Document
 
Call Girls Chorasi 7397865700 Ridhima Hire Me Full Night
Call Girls Chorasi 7397865700 Ridhima Hire Me Full NightCall Girls Chorasi 7397865700 Ridhima Hire Me Full Night
Call Girls Chorasi 7397865700 Ridhima Hire Me Full Night
 
Call Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call GirlsCall Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call Girls
 
Russian Call Girls juhu MUMBAI 00000000000000
Russian Call Girls juhu MUMBAI 00000000000000Russian Call Girls juhu MUMBAI 00000000000000
Russian Call Girls juhu MUMBAI 00000000000000
 
The Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty VixenThe Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty Vixen
 
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
 
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607
 
1681275559_haunting-adeline and hunting.pdf
1681275559_haunting-adeline and hunting.pdf1681275559_haunting-adeline and hunting.pdf
1681275559_haunting-adeline and hunting.pdf
 
Call Girls Near The Corus Hotel New Delhi 9873777170
Call Girls Near The Corus Hotel New Delhi 9873777170Call Girls Near The Corus Hotel New Delhi 9873777170
Call Girls Near The Corus Hotel New Delhi 9873777170
 
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...
 
Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713
 
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts Service
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts ServiceVIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts Service
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts Service
 
Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713
 
Gripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to MissGripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to Miss
 
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...
 
Call Girls CG Road 7397865700 Independent Call Girls
Call Girls CG Road 7397865700  Independent Call GirlsCall Girls CG Road 7397865700  Independent Call Girls
Call Girls CG Road 7397865700 Independent Call Girls
 

Game Lab

  • 1. DPP B2 (c) JOB SHEET COURSE : DIPLOMA IN DIGITAL MEDIA DESIGN SESSION : JAN - JUN 2012 SEMESTER : 4 CODE/SUBJECT : DDM 4323 - GAME DESIGN SHEET NO : JS-8 NO OF STUDENTS : 30 WEEK : 8 LECTURER : AZMI BIN MOHAMED TOPIC : 8.0 SPACE SHOOTER 8.1 Research and create a basics of movie clips and character movement for space shooter game SUB-TOPIC : 8.2 Add an interactive elements; lives and score for game 8.3 Add sound effects using ActionScript. After completing this topic, students should be able to: LEARNING 1. Develop their own space shooter games with random enemies. OUTCOME : 2. Create an interactive element; lives and score for their games. 3. Add a sound effects using ActionScript TOOLS / 1. Computer EQUIPMENTS / 2. Projector MATERIALS : 3. Adobe Flash CS4 INSTRUCTION : 1. Research the ActionScript for creates a space shooter game, character movement and shoot control using keyboard. 2. Follow step-by-step tutorial below to create a space shooter game. Page | 1
  • 2. DPP B2 (c) PROCEDURE : STEP KEY POINT Movie Clip and Movement 1. Open Adobe Flash and create new document (ActionScript 2.0)  Size: 800x600px  Frame Rate : 24fps  Background Color: Black 2. Create a Movie Clip by right clicking your library tab and selecting "New Symbol...", make sure "Movie Clip" is selected and choose a name. 3. Flash will create and open the Movie Clip for editing, so just paste an image or draw a space ship with Flash's drawing tools. After drawing your ship, get back to the main timeline by click on "Scene 1": At properties panel; put a variable name as “ship”. 4. Right click the first frame in your timeline this.onEnterFrame = function() and select "Actions". Type this: { if (Key.isDown(Key.RIGHT)) { Ship._x += 10; } else if (Key.isDown(Key.LEFT)) { Ship._x -= 10; } else if (Key.isDown(Key.UP)) { Ship._y -= 10; } else if (Key.isDown(Key.DOWN)) { Ship._y += 10; } } Page | 2
  • 3. DPP B2 (c) Shooting 5. This is the second part of the tutorial and we are going to enable the ship to shoot. Previously we made our ship fly; now we are going to make it shoot and set limits to where it can go. First we need to make our bullets, right click the library tab, select "New Symbol" and give it the name "Bullet". Before clicking OK, click Advanced, select "Export for Actionscript" and make sure the identifier is "Bullet". 6. We do this because we need to export the Bullet Movie Clip during running time to create many bullets and we will use the name determined in identifier to call it later. Draw a small bullet, and position it like this: This is called registration point, in the stage this is the position of the Bullet Movie Clip. 7. Now open the actions window of the first this.onEnterFrame = function() frame of the Movie Clip, insert this code: { this._x += 12; if (this._x > 800) { this.removeMovieClip(); } } 8. Now go to the main timeline, select the var i = 0; first frame and open the actions this.onEnterFrame = function() { windows. You will see the previous . codes that we have written. Add this . code to the old one so we can fire our . bullets: else if (Key.isDown(Key.DOWN)) { Ship._y += 5; } if (Key.isDown(Key.SPACE)) Page | 3
  • 4. DPP B2 (c) { i++; _root.attachMovie("Bullet", "Bullet" + i, _root.getNextHighestDepth()); _root["Bullet" + i]._x = Ship._x + 3; _root["Bullet" + i]._y = Ship._y; } } 9. Before we finish this tutorial, let's put if (Key.isDown(Key.RIGHT)) some limits to where our ship can go, we { don't want it to get off the screen. Make if (Ship.hitTest(800, Ship._y, these changes: true)) { Ship._x -= 5; } Ship._x += 5; } else if (Key.isDown(Key.LEFT)) { if (Ship.hitTest(0, Ship._y, true)) { Ship._x += 5; } Ship._x -= 5; } else if (Key.isDown(Key.UP)) { if (Ship.hitTest(Ship._x - 40, 0, true)) { Ship._y += 5; } Ship._y -= 5; } else if (Key.isDown(Key.DOWN)) { if (Ship.hitTest(Ship._x - 40, 600, true)) { Ship._y -= 5; } Ship._y += 5; } if (Ship.hitTest(800, Ship._y, true)) { Ship._x -= 5; } Page | 4
  • 5. DPP B2 (c) Enemies 10. This is the third tutorial of a series about developing a Space Shooter game, in this tutorial we are going to make enemy ships. Create a new Movie Clip and draw your enemy ship, don't forget to set the identifier to "Enemy" and select "Export to Actionscript". 11. Now drag the enemy Movie Clip to the onClipEvent(load) stage, give it an instance name of { "Enemy0", right click it and select function reset() "Actions". Insert this: { var timer = 12; this._y = Math.random() * 300 this._x = 550 mySpeed = Math.ceil(Math. random() * 6) + 1; } reset(); } // This part of the code creates a function called reset() when the Movie Clip loads for the first time. Inside reset() we set this._y to a random number between 0 and 600, this._x to 800 and the speed of our enemy to a random number between 1 and 6. 12. Then, insert this code: onClipEvent(enterFrame) { this._x -= mySpeed; if (this._x < -10) { reset(); } if (timer >= 12) { Math.ceil(Math.random() * 2) timer = 0; Page | 5
  • 6. DPP B2 (c) } if (dir == 1) { this._y -= 3; } else if(dir == 2) { this._y += 3; } timer++ } 13. Add this code in the main timeline before var nrEnemies = 3; the rest of the code. for (i = 1; i < nrEnemies; i++) { _root.Enemy.duplicateMovieClip ("Enemy" + i, _root.getNextHighestDepth()); } Lives and Score 14. This is the forth part of the development of a Space Shooter game. In this tutorial we will add lives, scores and game over to our game. Let's start with score.Open the main timeline code and add this variable: var score = 0; 15. Now open the Bullet's code and add this: this.onEnterFrame = function() { this._x += 9; if (this._x > 550) { this.removeMovieClip(); } for (i = 0; i < _root.nrEnemies; i++) { if (this.hitTest (_root["Enemy" + i])) { _root["Enemy" + i].reset(); _root.score += 10; this.removeMovieClip(); } } } // This is the code we used before to know if a bullet hits an enemy, so we can put the score for killing an enemy there. Page | 6
  • 7. DPP B2 (c) 16. The score is done; we just need to show the player his score. To do that, select the Text Tool and draw it on the stage. Write "Score:" 17. Now draw another Text box on the stage. Select this new Text box and change these properties: 18. Now let's make our ship have lives. Add var lives = 3; another variable in the main code: 19. And make these changes in the code if (this.hitTest(_root["Enemy" + i])) that checks if the player crashed with an { _root.lives -= 1; enemy: reset() for(k = 0; k < _root.nrEnemies; k++) { _root["Enemy" + k].reset(); } } Page | 7
  • 8. DPP B2 (c) 20. Draw two text boxes again 21. We can see the ship losing lives now, but nothing happens when it goes lower than zero. To change that we tell the player when its game over. Create a new movie clip. 22. Write "Game Over" using the text tool and go back to the main timeline. Page | 8
  • 9. DPP B2 (c) 23. Add this to the Ship's code: if (this.hitTest(_root["Enemy" + i])) { _root.lives -= 1; if (_root.lives <= 0) { _root.attachMovie("GameOver", "GameOver", 100) _root.GameOver._x = 275 _root.GameOver._y = 150 this.swapDepths(10); this.removeMovieClip(); } reset() for(k = 0; k < _root.nrEnemies; k++) { _root["Enemy" + k].reset(); } } Timer 24. Before we start with sound we need to make some changes. You may have noticed that our ship shoots bullets as much as the player press the space bar, that's not right as it makes the game much easier. To prevent that, we are going to add a timer and the ship will shoot as much as we want. First add a new variable: var timer = 8; Then, make this changes: this.onEnterFrame = function() { timer++; . . . if (Key.isDown(Key.SPACE)) { i++; if(timer >= 8) { _root.attachMovie("Bullet", "Bullet" + i, _root.getNextHighestDepth()); _root["Bullet" + i]._x = Ship._x + 3; _root["Bullet" + i]._y = Ship._y; timer = 0; } } } Page | 9
  • 10. DPP B2 (c) The code runs like this: Before:  If timer >= 8 then shoot a bullet and set timer to 0  Now that timer = 0, the bullet wont shoot, so the player has to wait all the code to run at least 8 timer to shoot again (timer++ will increase timer by 1 every frame)  Timer will be bigger than 8 again and the player can shoot. After: Sound 25. We can add the sound now. You need to have an mp3 file that's going to be the sound played when you fire. Now that you have your sound, click File > Import > Import to library...Select your mp3 file and click open, a new file should appear on the library. Right click it and click "Linkage..." Check "Export to ActionScript..." and set the Identifier to "shoot". This is the same thing we did previously with the Bullet Movie Clip, we need the linkage to call this on the code. Page | 10
  • 11. DPP B2 (c) 26. Add this to the shooting code: if (Key.isDown(Key.SPACE)) { i++; if(timer >= 8) { _root.attachMovie("Bullet", "Bullet" + i, _root.getNextHighestDepth()); _root["Bullet" + i]._x = Ship._x + 3; _root["Bullet" + i]._y = Ship._y; var shoot_sound = new Sound(); shoot_sound.attachSound("shoot"); shoot_sound.start(); timer = 0; } } 27. The game is done! Hope you enjoying developing and playing it. REFERENCES : 1. Andrew Rollings, Ernest Adams (2003). Andrew Rollings and Ernest Adams on Game Design. USA: New Riders Publishing. 2. Andrew Rollings, Dave Morris (2004). Game Architecture and Design:A New Edition. USA: New Riders Publishing. 3. Patrick O’luanaigh (2006). Game Design Complete. USA: Paraglyph Press. Page | 11