Bullet Travell distance

For questions about using Classic.

Post » Fri Jan 16, 2009 8:53 am

Is there a way to reset "Travelled distance" in bullet behavior?


ps. "activate at start" for bullet would be nice addon
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Jan 16, 2009 2:47 pm

I'm not quite sure what you mean. What is it that you're trying to do?
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Jan 16, 2009 3:16 pm

on debugger there's a "trevelled" under Bullet tab - it just shows distance the sprite travell from bullet activation.

and what i was doing is that:
When you press mouse button, bullet activates and move sprite to mouse position, sets distance value between mouse and sprite as a bullet "range".
If "bullet exceeded range" then bullet is deactivated and stops the sprite.

ie. on first couse click "range" is 300 (distance between mouse and sprite)
when sprite moves, "travelled" option is rising, when it reach "range" witch is 300 - > sprite stops - everything is fine.
but when you click mouse one more time the "travelled" keep rising up from 300...

It's nothing serious really, just having fun testing and playing with behaviors.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Jan 16, 2009 4:35 pm

Use a private variable, and always add (movement speed * TimeDelta) to the private variable. This is your new travelled distance, and you can set the private variable to 0 at any time.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Sat Jan 17, 2009 9:00 am

wow, that's a nice solution Ashley.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests