Picking up coins and scoring points

This forum is currently in read-only mode.
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Hello!

    I just stumbled across construct classic a couple weeks back and i'm making a simple super mario style platform game with coins to pick up and enemies to squash.

    I just need to know how I can make the objects I pick up affect my score. I have learnt how to create the object and destroy it on contact with my player but I don't know how to make this all add up and pop up on the HUD (which i still need to do but i'm sure thats pretty straightforward..)

    I've gone through a bunch of the platform tutorials but for some reason haven't found what i'm looking for yet..

    If anyone could help that would be great! I've found info on most other subjects apart from this one!

    Thanks for your time!!

    Sam

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi, I would probably do it like this:

    Select your player character and look at its properties.

    Add a private variable called "score", by default it should be a number and 0.

    Add a text box on another layer, name it and set that layer so that it doesn't scroll. This will be what displays your score.

    In your event sheet add a new system condition for "Always (every tick)" and then an action: select the text box, then select "set text" - the set text screen will come up as "" don't type anything in there yet, instead double click your player object, then "get private variable" - it will input something like player.Value('Variable name') - replace the 'Variable Name' with what you named your private variable before eg 'score' - keep the quotations. So now, every tick it will set the text box to whatever value the private variable 'score' is.

    So all you have to do now is add an action to whatever happens when you hit a coin - so on collision with player and coin add 1 to private variable 'score'

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)