Need help with my Reward system...

Get help using Construct 2

Post » Mon Jun 30, 2014 3:13 pm

I have an Autorunner game with powerups and I'm trying to create a reward system for my game, where if the player hits a certain score (123,456 in this example) then the powerups will amount to something like 5,000 instead of 1,000 as it is normally. I also want to change the powerup sprite when this happens so that it's a different colour.

So in my game, if the player dies then you'll have two options on the game over screen, Menu & Retry. If the score 123,456 is achieved, then instead of retry, a continue sprite will appear instead. What i want is when the continue button is pressed, the powerups change from 1,000 to 5,000 via a different sprite.

I've tried various different way in order to get the special powerups to appear rather than the normal ones when the score 123,456 is hit but i can't get it to work. I think the problem is that if i press the continue button, it goes restarts my game layout so it doesn't register any changes and starts normally.

I've provided a capx i've done, with this i've set the score to always be 123,456 when the player dies so that the continue button appears. I would appriciate any help to solve this.

Thanks
You do not have the required permissions to view the files attached to this post.
B
5
S
2
Posts: 126
Reputation: 876

Post » Mon Jun 30, 2014 5:40 pm

@tomhaiger instead of changing out the actual sprite objects, you could make one sprite object with multiple animations and have the sprite have an instance variable that holds the score (or whatever 1000 to 5000 means, I assumed points)

When the score hits 123,456. Change the sprite's animation and the value in the instance variable. So none of the game logic has changed, just what the sprite looks like and the number used in the instance variable.
B
21
S
5
G
1
Posts: 96
Reputation: 1,927

Post » Tue Jul 01, 2014 2:34 pm

Thanks but thats not quite what i'm looking for. I don't want the sprite to change while playing the game, i want it to only change when the player dies and their score happens to be 123,456.

When the player dies and the game over screen comes up, if their score is 123,456 then the Retry button on the game over screen will change to a Continue sprite (you can see this in the capx). What i want is, when the player presses Continue, the game will start normally but instead of the normal power ups it will be the special power ups that appear which give 5,000 points instead of the normal 1,000. This is what i'm trying to do.

I hope i've made it clear, i apologise if this is confusing anyone.
B
5
S
2
Posts: 126
Reputation: 876

Post » Tue Jul 01, 2014 2:52 pm

I think this is the type of thing you are after.

Autorunner Example.capx
You do not have the required permissions to view the files attached to this post.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Tue Jul 01, 2014 2:52 pm

Working on your capx, will edit this comment when done.

Edit: Looks like someone just fixed it for you, I'm not sure if as soon as you reach the "123456" mark you want the power ups to change or only when you die and start over(2nd option doesn't seen right to me).
My approach would be, save something like reachedCheckpoint on webstorage(so it doesn't get lost when you restart your layout, could also be a global variable),
have an event checking if reachedCheckpoint = 0 and currentScore > than 123456, if so set reachedCheckpoint to 1. Then when spawning powerups just check for reachedCheckpoint, if 0 spawn "Powerup1" else spawn "Powerup2".
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Post » Tue Jul 01, 2014 3:27 pm

@Minor Thank you, thats what i'm after. @caiorosisca Thanks for taking the time to work on my capx and for your suggestion, appriciate it.
B
5
S
2
Posts: 126
Reputation: 876

Post » Tue Jul 01, 2014 5:18 pm

First of all I realised that you check for the key GameHighscore on webstorage and then if it doesn't exist you create a key called Highscore, this way it will always overwrite Highscore, I guess you made a typo here. Fixed it.

I'm using @Minor's capx as a starting point.
It has a continue variable in Menu eventsheet which I'll be using to spawn the correct powerup.

At the start of the game eventsheet I check if there's already a key called Checkpoint, if not continue = 0 (never passed that checkpoint), but if there is that key, that means sometime I've been past that point, so I set continue to 1.

Following the same principles, when spawing a power up, each 3 seconds I use continue = 0 > powerup1.... continue = 1 > powerup2.

Now to the setting part, when the player dies I verify if the currentDistance is greater of equal my checkpoint value(which you decide whatever you want), I also check if continue equals 0 , and if so I set if to 1(got past checkpoint). Checking if checkpoint equals 0 makes sure I haven't already passed by the checkpoint, because If it is 1 I don't need to do that again.

At the end I set the webstorage key "Checkpoint" to 1(I create a key), this one is the one used at the start. If you want your game to start over at each sessions remove this action, if you want the game to keep the score and checkpoint even after you close the browser leave it on.
You do not have the required permissions to view the files attached to this post.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643


Return to How do I....?

Who is online

Users browsing this forum: PROxMTswatTR, sean080 and 38 guests