Author |
Message |
Degensquared
|
Posted: Thu Nov 22, 2007 12:25 pm Post subject: Spring Physics Game |
|
|
I recently played a game that involved a ball attached to a spring, and you had to swing it around, to destroy things, and I decided to try and recreate that game in Turing.
Comments are welcome!
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Degensquared
|
Posted: Thu Nov 22, 2007 2:41 pm Post subject: Re: Spring Physics Game |
|
|
Darn. Forgot to upload the game...
Description: |
|
Download |
Filename: |
springs.zip |
Filesize: |
337.83 KB |
Downloaded: |
293 Time(s) |
|
|
|
|
|
|
MichaelM
|
Posted: Thu Nov 22, 2007 2:51 pm Post subject: Re: Spring Physics Game |
|
|
Thats pretty awesome, and pretty hard too. I'd be curious to see how you got the ball to wind back toward the mouse. Great Job
|
|
|
|
|
|
darkangel
|
Posted: Thu Nov 22, 2007 4:52 pm Post subject: Re: Spring Physics Game |
|
|
pretty awesome
lol, i got to like 200 points. I kept on circling around the group of dots till they all come together then make one sweep to get them all.
THen i just kept on doing the same thing.
however,
im more interested in how your physics works,
Like how you give it the spring, but keep it from getting too long.
And of course how to get it to spring in the first place.
|
|
|
|
|
|
Degensquared
|
Posted: Thu Nov 22, 2007 8:23 pm Post subject: Re: Spring Physics Game |
|
|
Lol, well there I just do a simple formula for the x and y axises.
code: | Fspringx := (mousex - ballx) * <tightness of spring>
Fspringy := (mousey - bally) * <tightness of spring>
Fspringx *= <damping>
Fspringy *= <damping>
ballx += Fspringx
bally += Fspringy |
Essentially, this formula checks how far apart the spring is pulled, then multiplies that by a constant representing how springy the spring is.
The dampening simply accounts for the fact that the spring wont oscillate forever, and that it will come to rest. (basically in mine it removes one tenth of the force each time.)
Then I just add the force of the spring onto the position of the ball.
I'm not sure what you mean by it only goes out to a certain length.... Care to clarify?
Degen.
|
|
|
|
|
|
darkangel
|
Posted: Thu Nov 22, 2007 10:59 pm Post subject: Re: Spring Physics Game |
|
|
naw don't worry i was just rambling on, you answered all my questions and once again i will say good job and this will come in handy for future projects of mine.
|
|
|
|
|
|
StealthArcher
|
Posted: Thu Nov 22, 2007 11:23 pm Post subject: RE:Spring Physics Game |
|
|
Somehow I think you're supposed to avoid the little balls, darkangel...
|
|
|
|
|
|
darkangel
|
Posted: Fri Nov 23, 2007 2:46 am Post subject: Re: Spring Physics Game |
|
|
The main part of the thing isn't suppose to get hit, but the smaller springy thing is supposed to hit them.
If that makes any sense.
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Degensquared
|
|
|
|
|
|