Giter Club home page Giter Club logo

node-cli-game-example's People

Contributors

brandonarmand avatar christianroper avatar dependabot[bot] avatar ggangix avatar pedramp avatar polltery avatar sbab avatar ufko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

node-cli-game-example's Issues

Previous tile is not updated correctly to safe

When player moves to east and fights a monster, sometimes the previous tile where the player came from is not updated to "safe". This might need more testing to see what exactly is going wrong.

refactor app.js into different modules

Right now app.js is crowded with different functions, we need to move these functions into separate modules as stated below.


  • map-engine.js: (fixed in e7fc2f6)
    • displayMap
    • createMapFromArray
    • getFullDirection
    • displayPosition
    • getMovementOptions
    • obtainMovementOptionInfo
    • displayMovementOptions
    • getObjectFromCurrentPosition
    • movePlayerTowards
    • updateNextAndPreviousMapTilesAfterPlayerMovement
    • updateNextAndPreviousMapTiles

  • utils.js: (fixed in 86fecee)
    • create2dArray

  • battle-engine.js:
    • encounter
    • postBossEncounter
    • updateTile
    • postBattleEncounter

Reduce player power on loss

When the player fights a monster and losses, nothing really happens. They are simply stuck in the battle until they defeat the enemy. We need to add an enhancement so that when player losses a battle, they must also lose power equal to the monster power they fought, this will make the game a bit challenging and later on we can introduce items such as potions for the players to make use of.

Refactor type for loops into a function

For all the cards in the lib we don't have a type property. Instead we have a for-loop in the main file that automatically assigns the type. We need to move these loops into a separate function in utils.js.

The current code must be moved into a function.

// Add type because they are going to be merged in the map
for(var i = 0; i < monsters.length; i++){
    monsters[i].type = "monster";
}
for(var i = 0; i < bosses.length; i++){
    bosses[i].type = "boss";
}
for(var i = 0; i < specials.length; i++){
    specials[i].type = "special";
}
for(var i = 0; i < friends.length; i++){
    friends[i].type = "friend";
}

Player decides to move out of the map

Right now when a player is at the edge of the map (e.g. position 0,0) they are not supposed to move out of the map. For example below, the player is not given the option to move north, however they can still decide to move north, and if they do.. the game crashes.

TURN : 1
MAP VIEW
 *  *  *  * 
 *  *  *  * 
 *  *  *  * 
 *  *  *  * 
you are at 0,0
Here are your movement options..
S(South) : unknown
E(East) : unknown
SE(South-East) : unknown

We can fix this either by placing a check after player input or by using RegExp objects for prompt pattern.

    prompt.get({
        description : 'Please enter a movement option',
        type : 'string',
        pattern : customRegex,
        message : 'Please choose an appropriate movement option',
        require : true,
        before : val => val.toUpperCase()

Fix distribution of monsters/bosses/friends across the tiles

Currently if we increase the map size in config.js then the monsters/bosses/friends are not distributed across the map correctly, check mapEngine.createMapFromArray function as it only takes the size of the combination of monster/bosses/friends and not the map size. There is also another problem where the map size is smaller than the combination of monster/bosses/friends, this issue will cause few key tiles to be left out. We need to come up with a new way to lay the map tiles.

Add JSDoc for map-engine.js

Currently all the methods under map-engine.js look quite complicated without the documentation. It would be nice to have some JSDoc documentation to get a good idea of what each function does.

Graceful ending for the game

After the player finishes the game by finding Ciri, show score (i.e. no. of turns) and stats (if any) to the player.

Remove case sensitivity when selecting direction

Right now the game expects everything in capital letters when choosing direction. for example, to move north the player must input N. We can update this so that the players have an option to enter either n or N.

Add difficulty selection at the start of the game

We need to add a prompt before the game starts that will allow the players to choose the difficulty. The following difficulties will be allowed..

  1. (E) EASY : Player gets 25 POWER at the start
  2. (M) MEDIUM : Player gets 15 POWER at the start
  3. (H) HARD : Player gets 10 POWER at the start

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.