Infinite jumper platform scoring (not distance)

Get help using Construct 2

Post » Mon Oct 10, 2016 3:13 am

Trying my brain at an infinite jumper, i got everything working but the scoring system.

Right now i have:
Event - platform on landed
Condition - platform (family) > compare Y > platforms 'greater than' player.Y

Problem is, if the player keeps jumping on the same platform it will add to the score.

How can i get it so it will not continue to add to the score if the player just keeps jumping on the same platform.


Thanks for any help and input.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Mon Oct 10, 2016 8:21 am

Are the platforms separate instances of the same platform object? if so, give them an instance variable or boolean that toggles when the event first triggers/score is given. Then add a second condition into the landed event that checks that the variable/bool isn't set.

So something like :
Event - platform on landed
Condition - platform (family) > compare Y > platforms 'greater than' player.Y
Condition - hasScored(inverted) --------- give score, toggle hasScored true
B
47
S
17
G
81
Posts: 2,227
Reputation: 48,101

Post » Mon Oct 10, 2016 2:19 pm

Oh yeah, works perfect. Thank you again, @plinkie.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Wed Oct 12, 2016 10:24 pm

@plinkie

I just noticed that your events don't actually count each/every platform.

Example: if there is 1 platform a few pixels directly underneath another platform it will only count the platform the player actually landed on.

I've been trying for a couple hours to mess with the code but just cant figure it out.

If you could give some assistance...please.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Thu Oct 13, 2016 7:54 am

What are you looking for it to do? Yeah the logic above is for when you land on a platform, what do you want to happen with nearby platforms? Not sure I fully understand the game mechanics you are trying to achieve. Why would there be another platform only a few pixels underneath another platform?
B
47
S
17
G
81
Posts: 2,227
Reputation: 48,101

Post » Thu Oct 13, 2016 12:09 pm

In the infinite jumper demo the platforms are created randomly (layout width -20) and when they hit viewport bottom, and at a random Y spacing 8, 80 pixels apart.

Wen the game starts > player jumping. He jumps up from the 1st platform he is on > add 100 to Score.

But there are other platforms next to and underneath the player (greater than Player.X, Player.Y)

Those platforms (greater than) do not get scored unless the player has landed on them or untill they are destroyed.

I'd like the platforms that the player DOES NOT land on but that are greater than Player.Y to be counted also.

So if there are 5 platforms 20 pixels apart in a line on the Y axis, if the player jumps on to the highest plaform, those other 4 below the player are not counted until they reach the bottom of the viewport and are destroyed.

So there are 2 scoring modes- when the player lands on a platform, that platform and ALL others GREATER THAN Player.Y are scored, AND when the platforms are destroyed, they are scored also.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Thu Oct 13, 2016 4:18 pm

So they are scored when you jump past them basically? I guess you could record the x,y of the player at the start of the jump and on landed, say for all platforms if y is greater then add score.
B
47
S
17
G
81
Posts: 2,227
Reputation: 48,101


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests