Old Western Shooter

We'll be pulling together a series of video tutorials to help you get the most out of Thinking Worlds in this forum

Old Western Shooter

Postby Blacky » Thu Jul 07, 2011 10:32 am

Hello everyone,

This is advanced tutorial based on this one - Main logic is the same, but a lot of additional stuff added.

HUD system explanation is skipped in this tutorial, in this demo HUD logic is very simple.
Furthermore, I assume that you already prepared sounds and images.
;)

Right now, Thinking Worlds able to use only ".ogg" format for sounds and all art should be in dimension of 2 even if you are creating objects from the images.
Preparation of sounds and images is out of scope of this tutorial, but I'll reference some software for this.
To convert and edit your audio you may use Audacity it's free and very simple and for editing images you may use Paint.Net (Free), Gimp (Free) or Photoshop.

All sounds and images were prepared in Gimp and Audacity, and were taken from different web sites with free resources.

  • :arrow: Deviant-art - A lot of people allow to use their art for free
  • :arrow: Free Sound - Big collection of free sounds
  • :arrow: Sound Jax - Another big collection of free sounds


********************************************************************************************************************************************************

Assets and Camera:

Assets:

First, we need to create all objects from the images, for this we will use Image Model Builder, it's included in all Thinking Worlds installations.

As you can see in this game all Targets(Cowboys, Power-Ups), Background(Old Western Town), and Decoration (Tumbleweed) are objects:

ATTACHMENT1.png
ATTACHMENT1.png (21.62 KiB) Viewed 1376 times


When we created all objects, adding them all to the scene.

********************************************************************************************************************************************************

Camera:

Now the most painful part after this, we need to place a camera perpendicular to our background image and setup its view:

ATTACHMENT2.jpg
ATTACHMENT2.jpg (82.29 KiB) Viewed 1376 times


The distance and small angle is acceptable it depends what view we want to achieve. In this demo as you can see distance of the camera is not so small because when camera is away we have more space between to work within, and the camera itself is not 100% perpendicular.

After some corrections our view from the camera should look like this:

ATTACHMENT3.jpg
ATTACHMENT3.jpg (160.05 KiB) Viewed 1376 times


It's very important to remember configured game view, because in Thinking Worlds there is no such button as - "To Camera N view", so all time when we will want to place our market or something within the camera view we will need to setup our view in the application to our camera (Game) view. Maybe later such button would be implemented. :)

********************************************************************************************************************************************************
Last edited by Blacky on Tue Jul 12, 2011 3:00 pm, edited 4 times in total.
Blacky
 
Posts: 6
Joined: Wed Jul 06, 2011 9:45 am

Re: Old Western Shooter

Postby Blacky » Thu Jul 07, 2011 10:36 am

********************************************************************************************************************************************************

Markers:

Cowboys:

Now, after we have placed background and camera setup have been completed, we should place some markers. We need them in order to spawn objects in different positions and move them in different directions in the game. In this demo, markers have such positions:

ATTACHMENT4.jpg
ATTACHMENT4.jpg (245.21 KiB) Viewed 1374 times


As we can see, Red color represents "Cowboy 1" object and blue color represents "Cowboy 2" object. Dots represent marker placement. Solid colored Dots are closer to the camera than the background object and Dots with white dot inside them are behind the background object. Arrows represent directions.
Cyan color represents camera (Game Screen) view borders.

Within the Camera (Game) view we have only 4 markers, 2 markers are outside of camera view and one marker is behind the background.

Power-Ups:

Again, cyan color represents camera (Game) view.
Pink dots represent markers for power-ups, and pink arrows represent their directions.

ATTACHMENT5.jpg
ATTACHMENT5.jpg (218.14 KiB) Viewed 1374 times


********************************************************************************************************************************************************
Last edited by Blacky on Mon Aug 22, 2011 11:10 am, edited 1 time in total.
Blacky
 
Posts: 6
Joined: Wed Jul 06, 2011 9:45 am

Re: Old Western Shooter

Postby Blacky » Thu Jul 07, 2011 10:46 am

********************************************************************************************************************************************************

Game-Logic:

Alright, we have done a lot of preparation work: camera, background, markers - all done.
Now it's time for the logic, and how this game works.

ATTACHMENT6.jpg
ATTACHMENT6.jpg (138.04 KiB) Viewed 1373 times


Short Description: First, we want to select our Camera. Then we turning Off player control, in this demo we just don't need any controls except mouse. Afterwards initialization take place and after it game starts, and each group control its own role.

Before we continue, we should have several variables created, they are needed for power-ups, timers, stats and the game itself.

Variables:

  • Bullets - counts how many bullets available.
  • Power-Ups related:
    • AddAmmo - tracks if we have the "Additional Ammo" power-up. (Increase amount of bullets to 12 from 6)
    • MoreTargets - tracks if we have the "More Targets" power-up. (Decrease respawn time for the cowboys)
    • NoMiss - tracks if we have the "No Miss" power-up. (Decrease chance of missing to 0)
    • TimeStop - tracks if we have the "Time Stop" power-up. (Stop the game timer for 10 seconds)
  • Timers related:
    • MoreTargetTimer - counts how long MoreTargets should last
    • NoMissTimer - counts how long NoMiss should last
    • GameTimer - counts how long Game should last (60 seconds by default)
  • Score related:
    • TotalTime - total time spent in the game until the game end
    • CurrentScore - game score

Alright, we have created all these variables and now our Variable Editor should look like this:

ATTACHMENT7.jpg
ATTACHMENT7.jpg (121.47 KiB) Viewed 1373 times


Sound clip variable "Background" is used to stop background song when game ends.

********************************************************************************************************************************************************

Game-Logic Groups:

"Initialization" this group is used for almost all game HUD, variables and objects initializations.

By default we should Remove from the scene all objects except background, we will spawn other objects in different loops.
Also, all variables should be initialized to their default values.

"Bullets HUD & Reloading" in this group we are doing all work with Bullets HUD and Reloading.

It consists of two loops, and they are connected with each other and before each loop we initialize "Bullets" variable. When we have no "Additional Ammo" power-up small loop will be used, either bigger one.

Loop itself have many interconnected "Bullets" variable tests, and when we have small amount of bullets than before it hides corresponding HUD Bullet image. When we have 0 bullets it's showing HUD Reloading Text. Always after each cycle it tests the "Reload" button, after that we test have we or not "Additional Ammo" power-up, and if yes, then loop should be switched to another one.

"Timer & Time Stop & Game End" group consists of very simple game timer, and 2 variable tests. One is testing "GameTimer" and if it equals to 0 then it's The End. Another one is testing "TimeStop" variable and if it equals to 1 it means that we have Time Stop power-up, and timer should be paused for 10 seconds.

"Decor - Tumbleweed" group have one loop, at the beginning of the loop we are adding tumbleweed object to the scene, moving it to its marker, and then we have a random event node, we use it to randomly choose the speed of the tumbleweed.

"Game-Play" consists of 3 groups: "Cowboys appearance", "Power-Ups appearance" and "Clicked? If yes, destroy this object".

"Cowboys appearance" and "Power-Ups appearance" are very similar, they just have several "Random Event" nodes used to choose where to spawn cowboy or power-up, what direction and speed should be used. Also "Cowboys appearance" group have test to test if "MoreTargets" power-up presents.
"Clicked? If yes, destroy this object" group is just a loop to test if an object was clicked if yes then test for "NoMiss" power-up, after this with "Random Event" nodes choose if the player is missed or not, play some random sounds, add some points, and destroy the object (It's important, because we spawn them in different loop)

********************************************************************************************************************************************************
Blacky
 
Posts: 6
Joined: Wed Jul 06, 2011 9:45 am


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest