DemoProductions / fighter

2 stars 1 forks source link

Playerkoscreen #58

Closed ghost closed 8 years ago

ghost commented 8 years ago

With a basic menu

Reference: http://pixelnest.io/tutorials/2d-game-unity/menus/

flip40 commented 8 years ago

Is something missing here? I see the main menu screen and buttons all work fine, but it seems that a player's death is not actually triggering the game over script to activate.

flip40 commented 8 years ago

Oh I see what is wrong, I was causing player death by throwing them off the edge, this needs to be changed. We should probably stop destroying the player object on death and instead call some PlayerMovement.dead() or set dead = true and have the player script then deactivate the player gameObject. Or perhaps, better yet, if fell, set hp = 0 (taking damage will already eventually hit this case), and have health.Update say oh, player health is 0 (or less), they must be dead, dead = true. From here, we just check and when 1 or less players are still !dead, gameover.enabled = true. Something like that sounds right to me, what do you think?

But if you can just hack in a solution to cause gameover an falling death to is fine as a hack for now just to make sure we have it working by monday, but is notable as something that only works with 2 players and 1 life per player, which we might not want to keep in the future. Technical debt and all that.

Fall death is caused by OnTriggerEnter2D's if statement.

ghost commented 8 years ago

Ah I completely forgot about accounting for deaths off a ledge.

Think I was having some weird issues last night where I was adding files but actually working on a different directory in Unity. Player's aren't getting destroyed on death anymore. Let me pull this pull request into a new directory, I'm pretty sure I didn't add all the files I changed.

Edit: I added all the files I wanted last night. Right now I have a ko flag in Health. Checking for gameover that way sounds about right. Can also keep a count from the beginning of the scene on how many players are playing, and then maybe another variable that counts the number of players that aren't ko'd.

ghost commented 8 years ago

Oh so that's what the deathbox object was for. That's a good idea.

Ok so the gameObject currently gets destroyed when it touches the deathbox. I see more of what you mean now. I'm going to use the ko flag in Health

ghost commented 8 years ago

Pushed new changes. Used the scene script to act as a controller for the scene so that we know when it is game over.