Search Unity

How would I go about making my game work like this?

Discussion in 'Getting Started' started by bridgetkacprzyk174, Jul 22, 2019.

  1. bridgetkacprzyk174

    bridgetkacprzyk174

    Joined:
    Jul 5, 2019
    Posts:
    5
    So my idea for my end game is the player has to collect a certain number of hearts and then collide with a certain object (in this case a princess) and then the player will have won the game. How would I go about doing this?

    Side note I also have an idea that the player can collect tacos and after they've found all of the taco's the game displays a message. Any help on that would also be appreciated. TIA
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    So you have colliders on all the hearts and on the princess. You use OnCollisionEnter to detect the collision with each object. With hearts you increment some heart counter. With the princess in OnCollisionEnter you verify the heart counter is at least a certain number. If so you do something to indicate the game is won.
     
    Antypodish likes this.