Discuss Scratch

Hawmy
Scratcher
6 posts

Exponential Speed

In my game Space Badger I am trying get the speed of the lasers that they shoot out of their mouths to increase exponentially. How could I do this? Here is a link to the game: Space Badgers Thanks!

Last edited by Hawmy (Aug. 26, 2013 04:05:23)

Hadgerhadger
Scratcher
19 posts

Exponential Speed

The best way to do this would be to create a variable that keeps track of the speed of the lasers; whenever you want to increase the speed, set the variable to itself multiplied by itself (or itself multiplied by whatever number you want to multiply it by).
Hawmy
Scratcher
6 posts

Exponential Speed

Hadgerhadger wrote:

The best way to do this would be to create a variable that keeps track of the speed of the lasers; whenever you want to increase the speed, set the variable to itself multiplied by itself (or itself multiplied by whatever number you want to multiply it by).
Thanks! I'll try that!
bob6
Scratcher
100+ posts

Exponential Speed

Be sure to set a POSITIVE value for x at the start. You'll need a base that is positive to actually experience exponential growth.

Are you sure you want exponential growth on lasers? Usually lasers have constant speed. Also using exponential growth will either make the laser travel too fast for anything to detect it is there (because it doesn't smoothly move along the screen, it jumps from one spot to the next) or it will be just useless, considering that exponential growth on a base slightly larger than 1 is basically constant speed except a little faster each time.

I would recommend constant speed, but if you really want the laser to accelerate, try quadratic speed, i.e constant acceleration.
Hawmy
Scratcher
6 posts

Exponential Speed

bob6 wrote:

Be sure to set a POSITIVE value for x at the start. You'll need a base that is positive to actually experience exponential growth.

Are you sure you want exponential growth on lasers? Usually lasers have constant speed. Also using exponential growth will either make the laser travel too fast for anything to detect it is there (because it doesn't smoothly move along the screen, it jumps from one spot to the next) or it will be just useless, considering that exponential growth on a base slightly larger than 1 is basically constant speed except a little faster each time.

I would recommend constant speed, but if you really want the laser to accelerate, try quadratic speed, i.e constant acceleration.

When I said the lasers have exponential growth on speed, I should have been more clear. What I meant was that I wanted the speed to be constant in one shot, but increase for every shot. I want one shot of a laser to be faster than the shot before. If I didn't make sense please tell me. Thanks!

Powered by DjangoBB