Picking up coins and scoring points

For questions about using Classic.

Post » Sun Jun 17, 2012 5:22 pm

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

B
1
Posts: 1
Reputation: 227

Post » Mon Jun 18, 2012 9:35 am

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'
B
46
S
16
G
3
Posts: 133
Reputation: 4,955


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests