Platform Game Tutorial 01

Let's create a simple platform game!

The final project will look a bit like this.


But we all have to start at the beginning so follow these steps and you're on your way to create your very own platform game!

First download the graphics pack here and unzip the file into your local drive. Import all the images into your gamesalad project.

1) Create a new Gamesalad project and call it platformGame. Set the game screen size to iPhone 6 plus Landscape orientation. Reminder: Save your work often.



2) Create 4 actors:
    a) hero
    b) heroImage
    c) platform
    d) controller



3) Create 6 attributes:
    a) buttonLeft [boolean]
    b) buttonRight [boolean]
    c) buttonJump [boolean]
    d) maxJumpCount [Integer]
    e) heroSpeed [Integer] set this to 200
    f) heroJumpHeight [Integer] set this to 250




4) Click on the "controls" actor and add a RULE.

    a) when Key "left" is down
           [change attribute] game.buttonLeft [to] true
         otherwise/else
          [change attribute] game.buttonLeft [to] false



    b) change the heading/title of this rule to : Left Key

    c) copy this RULE and paste below it.

    d) Change the heading/title of this new RULE to Right Key

    e) Change the attributes from game.buttonLeft to game.buttonRight




    f) Repeat step (c to e) to create the jump RULE using the Spacebar Key and then set the game.buttonJump




    g) Add a change attribute below the 3 RULES and set the self.Color.Alpha to 0. Set the "control" actor color to any color other than white.



5) Next go into the hero actor.

    a) Set the width to 24 and height to 50. (do not unlock the prototype)

    b) Set the physics values:
         1) Density: 1
         2) Friction: 0
         3) Bounciness: 0.2 (Let's have a little bounciness to the character)
         4) Fixed rotation: true
         5) Movable: true



    a) Add an Accelerate behavior  in the actor. (reminder: make sure this is in prototype and not unlocked!) Direction is 270 (downwards) Acceleration to 450. (Note: this is to add "gravity" to the hero)


 
    b) Add a RULE:
        if game.buttonLeft is true
        if game.buttonRight is false
            Constrain Attribute: self.motion.Linear Velocity.X to -game.heroSpeed





    c) Copy this rule and paste below it. Change the conditions to:
        if game.buttonLeft is false
        if game.buttonRight is true
            Constrain Attribute: self.motion.Linear Velocity.X to game.heroSpeed



    d) Copy this rule and paste below it. Change the conditions to:
        if game.buttonLeft is false
        if game.buttonRight is false
            Constrain Attribute: self.motion.Linear Velocity.X to 0




    e) Copy this rule and paste below it. Change the conditions to:
        if game.buttonLeft is true
        if game.buttonRight is true
            Constrain Attribute: self.motion.Linear Velocity.X to 0




    f) Copy this rule and paste below it. Change the conditions to:
        if game.buttonJump is true
            Constrain Attribute: self.motion.Linear Velocity.Y to game.heroJumpHeight
            Change Attribute: game.buttonJump to false




6) Now we'll make changes to the "platform" actor.
 
     a) Set the size to 37 both width & height.
     b) Set the Horizontal Wrap to Tile
     c) Add the image "ground1.png" into the actor. This image has the size of 37 for both width and height
     d) Change the following Physics values:
           1) Density: 999,999
           2) Friction: 0
           3) Bounciness: 0
           4) Fixed Rotation: True
           5) Movable: False
       e) Add a Collide behavior to collide with the "hero" actor.



7) Let's go back to the scene and add the "platform" actor onto the stage. Put one at the bottom so that it will be the ground. Stretch the actor lengthwise so that it covers the entire width of the stage. The image of the platform should be repeated/tiled. Next add a few shorter sized platforms above the ground.



8) Alright! We'll now add the "controls" actor and the hero actor into the scene. Preview the game.
So this ends the first part of the tutorial.




Continue on to tutorial 2!



Comments

  1. Assalamualaikum...Bole tahu guna software apa??

    ReplyDelete
    Replies
    1. Alaykumsalam gunakan Gamesalad.

      Delete
    2. Kalau guna software seperti jcreator atau netbeans?
      Kalau kita nak buat games, kita kena guna software yang ada kaitan dengan game juga ke?

      Delete
    3. Kalau guna 3rd party software seperti Gamesalad boleh buat games dengan cepat. Kalau guna software seperti lain yang juga boleh buat apps akan ambil lebih banyak masa.

      Delete
    4. Terima kasih atas info berkenaan.

      Delete

Post a Comment

Popular Posts