Pamblam / snek

stupid snek
https://pamblam.github.io/snek/
14 stars 35 forks source link

Create players form #80

Closed Pamblam closed 5 years ago

Pamblam commented 5 years ago

In the form where the user gives his name we need to add more options.

  1. one player or two players
  2. color for each of the players (red, blue, yellow, or brown)
  3. game mode ('stamina' or 'longest_wins')

For now the second player will always be a bot (later I'll create a server so two players can play each other live from different computers)

At the top of game.js there is an array called sneks. It starts out with a snek instance in it, but you will have to change it to start with an empty array then add each player to that array after the user submits the form. The first user in that array is always the live player. If there will be two players add a second snek instance to that array.

The Snek contructor now has two arguments. Add a player like this..

sneks.push((player_type, color));

player_type should be 'live' or 'bot'. The first instance in the array should always be 'live' and the second should always be 'bot'.

color should be one of the following: 'red', 'blue', 'yellow', or 'brown'

Whatever the user chooses for the game mode should be set to the global variable: game_mode (either 'stamina' or 'longest_wins') - if stamina is chosen the first player to run into something loses. if longest wins, whoever has the longest snek at the end wins.

I've already written the bot and the game mode logic. All we need is this form to be implemented as described above.

MiguelGT98 commented 5 years ago

Hi! I'd be happy to help

Pamblam commented 5 years ago

That would be awesome, i'd appreciate it.

MiguelGT98 commented 5 years ago

So I see someone else already worked on this, thank you for the opportunity though.

Pamblam commented 5 years ago

@MiguelGT98 - Too many people working on this to keep track of who said what. I assumed the person who commented on the issue was the person who submitted the PR. By all means though, feel free to make any other changes you think would make things look or feel better and submit a PR.