Search Unity

Game score attached to direct contact into a random platform

Discussion in '2D' started by Ruisuchikin, Dec 15, 2017.

  1. Ruisuchikin

    Ruisuchikin

    Joined:
    Dec 15, 2017
    Posts:
    11
    Well hello, im a noob using Csharp, so setting different type of movements and whatelse confuse me.

    Heres the question:

    How i make the game score be attached to the platform, this game is made in 2D so i need some help!

    Thanks and have a good day.
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    What does this mean? Can you post a screen shot or mock-up showing what you want to do?
     
  3. Ruisuchikin

    Ruisuchikin

    Joined:
    Dec 15, 2017
    Posts:
    11
    I need the UI text to update integral numbers (1,2,3,4,.....), when the object collides with a platform.
     

    Attached Files:

  4. Ruisuchikin

    Ruisuchikin

    Joined:
    Dec 15, 2017
    Posts:
    11
    setting the score based on the "player" colliding with any platform
     
  5. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    OK, then break this down into smaller problems:

    1. Can you detect collisions between the player and a platform at all? Try to get a Debug.Log to log a message when this happens.
    2. Can you update the score at all? Make a script with a public method to increment the score, and (for testing purposes) invoke it from a UI.Button event.
    3. Finally, invoke that same method from an event in your platform script, or (if that's inconvenient, perhaps because the platforms are instantiated from prefabs) write code to find a reference to the score script, and invoke the increment method that way.
    So now instead of one problem, you have three problems. :) But each one is smaller and more focused. Let us know if you get stuck on any of them — and please include plenty of detail about what you tried, and what went wrong!