Reload Problem

Post your own tutorials, guides and demos.

Post » Sun Aug 24, 2008 2:27 pm

This is what is meant to happen. The gun shoots then waits 250 milliseconds then shoots again.
The problem is it works fine for the first few seconds but then it speeds up the process.
Does anyone know what is wrong or knows how to fix this??
B
2
G
4
Posts: 50
Reputation: 1,150

Post » Sun Aug 24, 2008 3:05 pm

The problem lies in the event
[code:1vtgmywb]> GunSubtract 1 * tickcount from 'Reload'[/code:1vtgmywb]

If it was

[code:1vtgmywb]> GunSubtract TimeDelta from 'Reload'[/code:1vtgmywb]

And if the "loading" action was

[code:1vtgmywb]> GunSet 'Reload' to 0.250[/code:1vtgmywb]

It worked. Of course you can multiply TimeDelta by 1000 and use the current 250 value.

See, the TimeDelta there means that it subtrackts "1" from the 'Reload' per one second. So, if the reload value is 0.250 it becomes less than zero in 250 milliseconds.
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Sun Aug 24, 2008 6:21 pm

wow thanks I can't belive it was that simple.
I spent hours trying to figure this out.

By the way what is the tickcount for im not 100% sure even though i used it.
B
2
G
4
Posts: 50
Reputation: 1,150

Post » Sun Aug 24, 2008 6:33 pm

[quote="Steelsmasher":3d2p53ez]By the way what is the tickcount for im not 100% sure even though i used it.[/quote:3d2p53ez]

This is why I am a firm believer in commenting everything in your program.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Aug 24, 2008 9:17 pm

I may be wrong but I think he means in general what is it for, not why he used it. :shock:

Not that I don't support commenting ;)
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Mon Aug 25, 2008 8:02 pm

See System expressions for TickCount, and Ticks.

Since the tick count is always increasing, you definitely dont want to use it there!
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests