Jump to content

Difficulty Selection


Heppell08
 Share

Recommended Posts

I thought about this and wondered if global variables were able to be placed in an if() so that they would be loaded if a specified game selection was made. My other though was basically creating each game numerous times but with the difficulty varying per each created game. I'm totally not sure how to go about difficulty selection but any ideas on this would be well worth the knowledge. Thanks :)

Link to comment
Share on other sites

Maybe creating class Difficulty containing some global variables defining enemy HP, speed, things like that, and then use them in Enemy class or something ;) That's my idea for that

 

For example you can create object when user change difficulty in game 

var hard = new Difficulty('hard');game.difficulty = hard;

then in Enemy Class for example

function Enemy() { this.health = game.difficulty.hp; this.speed = game.difficulty.speed;}etc.

You can also make something like this for pathfinding, where game.difficulty.pathfindingMethod is method with pathfinding algoritihm.

function Enemy() { this.pathfind = game.difficulty.pathfindingMethod}

That's my loose ideas for that ;)

Link to comment
Share on other sites

Is there a way to go across states with changing the difficulty? I want to make the game difficulty from the main menu with a button press. I've tried putting 

 

var difficulty = 1;

 

Then in main menu i have a button function that changes the state to the game. I tried to put:

 

this.game.difficulty = 10;

 

But all i get is an undefined error and the difficulty stays at 1.

 

Any ideas?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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