Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Spring Physics Game
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Degensquared




PostPosted: 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! Very Happy
Sponsor
Sponsor
Sponsor
sponsor
Degensquared




PostPosted: Thu Nov 22, 2007 2:41 pm   Post subject: Re: Spring Physics Game

Darn. Forgot to upload the game...


springs.zip
 Description:
spring game

Download
 Filename:  springs.zip
 Filesize:  337.83 KB
 Downloaded:  293 Time(s)

MichaelM




PostPosted: 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




PostPosted: 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. Very Happy

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




PostPosted: 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? Very Happy

Degen.
darkangel




PostPosted: 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




PostPosted: 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




PostPosted: 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. Laughing
Sponsor
Sponsor
Sponsor
sponsor
Degensquared




PostPosted: Fri Nov 23, 2007 2:15 pm   Post subject: RE:Spring Physics Game

Yeah essentially there is no point, there's just a counter that checks how much you kill, so you can try and get a higher score XD

I really just made it to test out the physics, I'll post the source tonight so you guys can see the AI, and all the calculations working together Very Happy

EDIT:

Source Very Happy



springs.t
 Description:
Springs Source

Download
 Filename:  springs.t
 Filesize:  3.55 KB
 Downloaded:  126 Time(s)

Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: