Making a speedometer

Get help using Construct 2

Post » Sun Sep 21, 2014 4:02 pm

Hello

I am trying to make a speedometer, but i have no idea how can i. Does anyone have an idea how to do?

Thanks
B
18
S
2
G
1
Posts: 67
Reputation: 1,329

Post » Sun Sep 21, 2014 4:35 pm

maybe you san use "set angle" to your speed indicator, to point at your current speed
"If you want to move a mountain tomorrow, you should start by lifting stones today."
B
62
S
14
G
2
Posts: 286
Reputation: 6,576

Post » Sun Sep 21, 2014 4:50 pm

I have done this before. The way I did it is with a sprite for the needle. Then I plugged in a formula:
every tick | set angle to 185/700*Player.Car.Speed + 45. (my needle sprite is pointed straight down, so using this formula, at 0 speed, the needle points 45 degrees past straight down which is bottom left, and at 700 (my car's max speed) it points 230 degrees (185/700*700 + 45 = 230) past straight down which is top right.

My capx is too big to upload to the forum, but if you need to see it, I'll try to shrink it or put it on google drive or something. Just let me know.

EDIT: Wasn't too hard to shrink. Just check out the every tick event and the needle sprite.
speedometer.capx

(W for gas, S for brake)
You do not have the required permissions to view the files attached to this post.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Sun Sep 21, 2014 5:10 pm

spacedoubt wrote:I have done this before. The way I did it is with a sprite for the needle. Then I plugged in a formula:
every tick | set angle to 185/700*Player.Car.Speed + 45. (my needle sprite is pointed straight down, so using this formula, at 0 speed, the needle points 45 degrees past straight down which is bottom left, and at 700 (my car's max speed) it points 230 degrees (185/700*700 + 45 = 230) past straight down which is top right.

My capx is too big to upload to the forum, but if you need to see it, I'll try to shrink it or put it on google drive or something. Just let me know.

EDIT: Wasn't too hard to shrink. Just check out the every tick event and the needle sprite.
speedometer.capx

(W for gas, S for brake)



Thanks a lot! I will check it out.
B
18
S
2
G
1
Posts: 67
Reputation: 1,329


Return to How do I....?

Who is online

Users browsing this forum: el3um4s and 10 guests