Skip to content

19WAS85/old-school-racing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Old School Racing

A pseudo3d old school racing game made with pure Javascript.

It was made to be a racing game platform, to create any kind of race as the golden age of fun.

Check a demo version with a random generated track and seven cpu cars (with a really dumb intelligence):

Creating a Race

// create new track
var track = new Track('Test Track');

// add the first segment of the track, white, for the start line
track.addSegments(1, { color: 0xEEEEEE });

// add 80 segments (a stright)
track.addSegments(80);

// add a right curve with a up hill
track.addSegments(20, { curve: -0.5, hill: -0.1 });

// add a tree in the 10th segment at 500px (right)
track.addObject(10, 'assets/tree.png', 500);

// create a car to player
var playerCar = new Car('assets/sidewinder.png');

// create a car to cpu
var cpuCar = new Car('assets/sidewinder.png');

// create a race
var race = new Race(track, [playerCar, cpuCar]);

// create a render to show the race in the screen
var render = new RaceRender(race);

// create keyboard control to player car
var keyboard = new KeyboardControl(playerCar);

// create a basic cpu control to other car
var cpuControl = new BasicCPUControl(cpuCar);

Next Steps

  • Create unit test;
  • Improve performance;
  • Improve race;
  • Improve design.

How to Contribute?

  1. npm run watch to generate a development version of main js;
  2. Use the index.html as your sandbox;
  3. npm run build to generate the final version of main js.

About

A pseudo3d old school racing game made with pure Javascript.

Resources

License

Stars

Watchers

Forks

Packages

No packages published