Setting score in relation to player movement speed

Get help using Construct 2

Post » Tue Feb 07, 2017 2:10 pm

I have a a car that is driving. Every .25 secs that the speed is greater than 100, it adds 1 to the player score variable. However, if the player slows down (hitting a wall), I want the score speed to slow down. Is there an easy way for me to link the rate at which 1 is added to the score variable in relation to the player speed?
B
6
S
1
Posts: 71
Reputation: 548

Post » Tue Feb 07, 2017 10:25 pm

B
48
S
9
G
10
Posts: 200
Reputation: 8,258

Post » Wed Feb 08, 2017 1:31 am

What do you want the score to do when you slow down or stop?
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Wed Feb 08, 2017 1:28 pm

luisgmolina wrote:Image
Here the example
Capx file:
https://drive.google.com/file/d/0B9uHUU ... sp=sharing

Thank you, this is how I currently have my score set up. I want it to speed up and slow down, not just >100


lamar wrote:What do you want the score to do when you slow down or stop?

Ideally I would like the score to increase with the speed of the player. So if they slow to a crawl, so will the score. I guess I want the score to be linked to the RPMs instead of setting it to every .25 seconds
B
6
S
1
Posts: 71
Reputation: 548

Post » Wed Feb 08, 2017 2:56 pm

Shack wrote:
luisgmolina wrote:Image
Here the example
Capx file:
https://drive.google.com/file/d/0B9uHUU ... sp=sharing

Thank you, this is how I currently have my score set up. I want it to speed up and slow down, not just >100


lamar wrote:What do you want the score to do when you slow down or stop?

Ideally I would like the score to increase with the speed of the player. So if they slow to a crawl, so will the score. I guess I want the score to be linked to the RPMs instead of setting it to every .25 seconds


OK yes you will need a global variable and use Every Tick to set that to the players speed.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Thu Feb 09, 2017 1:11 pm

lamar wrote:OK yes you will need a global variable and use Every Tick to set that to the players speed.


But how? If I set every tick, check player speed and add to score, I'm going to get some crazy numbers (max speed is 1000). My current work around is this, but it does not give me accurate readings.

Every 1 second if speed is greater than 100 add 1 to score
Every 0.5 second if speed is greater than 400 add 1 to score
Every 0.25 second if speed is greater than 900 add 1 to score

Is this the only way for me to do what I am trying? Just have to add more speed checks, maybe for every 100 speed?
B
6
S
1
Posts: 71
Reputation: 548

Post » Thu Feb 09, 2017 1:54 pm

If you don't want it checked every tick and added to score the you will have to set limits as you have done and every 50 or 100 would work.

I would have to see your game capx to tell you more as I am not sure how your game is played to give you any more suggestions.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Thu Feb 09, 2017 2:55 pm

lamar wrote:If you don't want it checked every tick and added to score the you will have to set limits as you have done and every 50 or 100 would work.

I would have to see your game capx to tell you more as I am not sure how your game is played to give you any more suggestions.


I can share it later once its a little more put together.

I don't mind it checking it every tick, I just dont understand how to add points to the score in smaller increments. If the player is driving and their speed is 687, is it going to add 687 to the score, then 688, then 689, etc.? That score will go off the charts very quickly. I wanted to keep the score raising, in the single to double digits, not triples and quadruples.
B
6
S
1
Posts: 71
Reputation: 548

Post » Thu Feb 09, 2017 3:22 pm

Then you will need to set a speed number to check instead of every tick.

You use global variables for that

Global Variable SPEEDCHECK =0

Every Tick Set SPEEDCHECK to Player Speed

On SPEEDCHECK = 25 Add 25 to Player Score Set SPEEDCHECK to 1001
On SPEEDCHECK = 50 Add 50 to Player Score Set SPEEDCHECK to 1001
On SPEEDCHECK =0 Subtract 100 from Player Score Set SPEEDCHECK to 1001

It all depends on how you want your game played but those are the events and you just have to set them how you want your game played.

You have to set SPEEDCHECK to a number you are not checking after each speed check event or it will keep adding to the score as long as the player maintains that speed.
Last edited by lamar on Thu Feb 09, 2017 3:29 pm, edited 1 time in total.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Thu Feb 09, 2017 3:27 pm

B
48
S
9
G
10
Posts: 200
Reputation: 8,258


Return to How do I....?

Who is online

Users browsing this forum: Bootfit and 16 guests