Difference between revisions of "Simple Racer"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(The map itself)
(The map itself)
Line 37: Line 37:
 
I have also created an object layer with the players starting location, the 2 check points and the start line all stored as objects. I have also created  a custom property for the number of checkpoints (this may change depending on the track).
 
I have also created an object layer with the players starting location, the 2 check points and the start line all stored as objects. I have also created  a custom property for the number of checkpoints (this may change depending on the track).
 
   
 
   
[[File:Racer map.gif]]
+
[[File:Racer map.gif|800px]]

Revision as of 13:49, 8 December 2017

This tutorial will show you how to create a top down racing game, you will create a track, and your car will be able to complete a lap, time the lap, and potentially to complete a set number of laps. It will also cover simple AI to make the a ghost car drive around your circuit.

You could go on to learn about adding traction or skidding, adding collectables or weapons

Creating the Map

Tiled

You will firstly need to install the Tiled program from the website and link below. In college the Tiled executeables are on moodle, under project, technical skill, monogame, and tiled. I have also added links to other tutorials for using Tiled.

Tiled Website and Download

Tiled Map Editor

Tutorials for using Tiled

Offical Tiled Tutorials

Tiled Basics

Tiled Youtube Playlist Series

Written Version of Above Tutorials

Create a Map in Tiled

Map Settings

You will need to create a new map in tiled, the settings window below should be displayed:

Tiled settings.gif

The Tile size will need to match the tile size of your tileset. You can also specify the number of tiles in your your map, this and the tile size will create a map of a given size in pixels. The tiles i will use are 128 x 128 pixels, this will create quite a large map but we are only going to show the area around the car and not the whole map at once. You should be able to leave everything else the same.

You should now have an empty map, later on we will use Square.Tiled to draw the map this only supports maps in the Base64 GZIP format. So in the properties panel set the Tile Layer Format to Base64 (gzip compressed):

File:Tiled compression setting.gif

The map itself

I have created a map with 3 different tile layers, one for the collision which includes all of the tyres, a track layer which only contains the track peices, and a layer for the mud or grass for the background.

I have also created an object layer with the players starting location, the 2 check points and the start line all stored as objects. I have also created a custom property for the number of checkpoints (this may change depending on the track).

Racer map.gif