How do I add score by comparing the distance travelled?

Get help using Construct 2

Post » Sat Aug 01, 2015 1:27 pm

So, the idea is the score is based on percentage...

The layout width is 720 and for every 7.2 (since it is the 1% of 720) Layout width that is travelled by the player, the score gets added by 1%.

I made a really tall invisible and thin pillar sprite for every 7.2 layout width, so whenever the player hits that sprite, the score gets added by 1%, which means I add 100 sprite, so whenever the player hits that sprite, the score gets added.

It worked, but unfortunately, I noticed that when I did that, the game really lags as it is developed for mobile games & I am trying to keep the objects/sprites below 80 so the game won't cause any lag in player mobile device.

Anyone got a solution for this?
https://itunes.apple.com/us/app/id1004254105

We bet anyone a hundred dollars if they can reach the bone on the other side of the screen! (Only on the Impossible Mode)
B
10
S
2
Posts: 122
Reputation: 1,004

Post » Sat Aug 01, 2015 1:36 pm

I guess you could just set the score to : floor(player.x/7.2)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Aug 01, 2015 1:53 pm

The player character is flying, it doesn't run on the floor... So instead of "floor" what do I use?
https://itunes.apple.com/us/app/id1004254105

We bet anyone a hundred dollars if they can reach the bone on the other side of the screen! (Only on the Impossible Mode)
B
10
S
2
Posts: 122
Reputation: 1,004

Post » Sat Aug 01, 2015 1:56 pm

ondraayyy wrote:The player character is flying, it doesn't run on the floor... So instead of "floor" what do I use?


:) haha

Floor() is an expression, not an actual floor..
It rounds the number down.
0.7 will become 0
1.2 will become 1
etcetera
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Aug 01, 2015 2:08 pm

@littlestain haha what a shame, I didn't know it was an expression, can you simplify it by providing a screenshot or something?
https://itunes.apple.com/us/app/id1004254105

We bet anyone a hundred dollars if they can reach the bone on the other side of the screen! (Only on the Impossible Mode)
B
10
S
2
Posts: 122
Reputation: 1,004

Post » Sat Aug 01, 2015 2:15 pm

ondraayyy wrote:@littlestain haha what a shame, I didn't know it was an expression, can you simplify it by providing a screenshot or something?


there is not much to simplify..

system every tick
> set score : floor(player.x/7.2)

It's as simple as that..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Aug 02, 2015 9:37 am

LittleStain wrote:
ondraayyy wrote:@littlestain haha what a shame, I didn't know it was an expression, can you simplify it by providing a screenshot or something?


there is not much to simplify..

system every tick
> set score : floor(player.x/7.2)

It's as simple as that..



Thanks, I'll try it out soon
https://itunes.apple.com/us/app/id1004254105

We bet anyone a hundred dollars if they can reach the bone on the other side of the screen! (Only on the Impossible Mode)
B
10
S
2
Posts: 122
Reputation: 1,004

Post » Sun Aug 02, 2015 11:51 am

ondraayyy wrote:The player character is flying, it doesn't run on the floor... So instead of "floor" what do I use?


hehehehhehe you made my day ty :lol:

just do what stain told you
Image
B
28
S
11
G
2
Posts: 139
Reputation: 3,299


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 5 guests