Jump to content

game states: calling create for new levels


mxschumacher
 Share

Recommended Posts

Hi there,

being new to JS and game development I have two questions (I'll create a post for each) regarding a implementation of Frogger I'm working on. Part of the images are taken from Udacity's OOP JS course, though I'm not enrolled in the program anymore (so you're not helping me cheat).
 

Similar to the original Frogger I would like to implement several levels that vary in terms of enemies' speed, the kind of enemies, the kind of goodies that can be collected etc.

I've trouble with starting the next level (as player hits a lilypad), I want to call the create function again but with different parameters based on my definitions of what constitutes each level:

 

var gameState = [	{	speed: 0.1 * gameWidth,	enemies: ['truckBug'],	gems: ['orangeGem'],	BlockRocks: false,	spawnFrequency: 5000},	{	speed: 0.15 * gameWidth,	enemies: ['truckBug', 'bot'],	gems: ['orangeGem'],	BlockRocks: false,	spawnFrequency: 4000},	{etc ...

Should I redraw the whole world for each level?
Is this best implemented via game states, e.g. one state per level?
 

The whole code-base can be found here: 

https://github.com/MaxSchumacher/Frosch

Any hints/help would be greatly appreciated!

Greetings,
Max

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...