Could someone please post an algorithm for acceleration and gravity (along the lines of the bullet in Kerm's Scarth game Wink )
Well I don't know how to do the gravity, but I do know how to do velocity without gravitational effects. Something like 16x^2 should do. For one of my programs, I increment x by a value, I think it was .24... , plug it in to the expression, and display a sprite at the x-location provided by the expression.
or, you could always look at the source to get an idea (but make sure that you are allowed to first)
something1990 wrote:
Well I don't know how to do the gravity, but I do know how to do velocity without gravitational effects. Something like 16x^2 should do. For one of my programs, I increment x by a value, I think it was .24... , plug it in to the expression, and display a sprite at the x-location provided by the expression.


I might have an idea for gravity... also, i can use the distance away from the ground to determine current gravity... (i guess normal would be along the lines of 5 or something)

Right now i am simply musing over the idea to create a simple cannon game...
A simple cannon game is on my to-do list. It is based off one of the mini-games in LOZ:Wind Waker.
something1990 wrote:
A simple cannon game is on my to-do list. It is based off one of the mini-games in LOZ:Wind Waker.


yeah... I was thinking something along the lines of a simple game, it would be really slow, but same concept as kitten cannon (except the kitten part)

Not sure how i would do that though (random map generation and the displaying of it)... Or i could do a cannon game where you shoot at a moving target off the screen (arrow tells u the y coordinates)
Knowledge of basic physics is useful.


^Force of gravity two objects exert on each other^

That being said, you'll probably find this more useful: http://en.wikipedia.org/wiki/Equation_of_motion
I LOVE kitten cannon! It's so much fun seeing little kittens bounce! It's the simple things that keep us entertained... If you don't have a knowledge of basic physics, calculus should also help.
jpez wrote:


Where G = 6.67 * 10^-11.

Also, if this is taking place on earth (or a planet/place with the same or similar mass) you can just use 9.8 m/s as the acceleration.
jpez wrote:
Knowledge of basic physics is useful.


^Force of gravity two objects exert on each other^

That being said, you'll probably find this more useful: http://en.wikipedia.org/wiki/Equation_of_motion


lol i am in seventh grade I have not taken physics yet!

Or calculas for that matter...


I have decided to examine the source of all those useful science programs in the ti 83+ section of ticalc.org (most of the ones that calculate max height, speed when hitting ground, general equations etc.) Maybe that will help me
See if you can do this: Calculate the vector forces on a bunch of objects of given mass and at given positions exert on each other, move them a tiny bit, and repeat. (I have a feeling this will end up being a job for Kerm/me.) Should make for some funness... If you can't do that, try calculating the forces on one moving object exerted by a bunch of fixed ones.
To give you a little more explanation on how it would be done:

Let's call the X,Y coordinates of object 1 A,B; and the X,Y coordinates of object2 C,D. Now using the distance formula (google it if you don't know it), we can calculate "r." Next, just plug in r and the appropriate masses for each object, and substitute 6.67*10^-11 for G and find the force that the objects exert on each other. This is the total force.

This force is in two directions (as Newton's third law states). We can clear up the two direction problem by solving for a single object at a time.

It is important to note, as jpez has stated, this force is a vector. A vector is merely a force in a direction. Now, this vector will not always be pointed directly horizontal or directly vertical (in fact, most of the time it won't be) so we need to know how much force is horizontal and how much force is vertical for a given vector. To do this we are going to use our good friends Sine and Cosine for the vertical and horizontal parts respectively.

First off we need to know the angle of this vector. Well, to get that, we are going to need to know the slope between these two cartesian points. This is simply the change in Y over the change in X. In this program that will be (D-B)/(C-A). Make sure your calculator is in degrees mode. Now we will take the arctan( of that to find out the angle. The angle that this will return will be between -90 and 90 not inclusive. But, depending on the situation, the true angle will be a third quadrant or fourth quadrant angle. In these cases, you must add 180 degrees to this angle. I'll leave it up to you on how to implement this adding of 180 degrees to it.

Now, we have a force and we have an angle. Guess what...we have a vector! The rest is easy. Now we need the vertical and horizontal parts of this vector. To do this let's assume F = total force and theta is the angle.

F*sin(theta) = vertical part
F*cos(theta) = horizontal part

There it is, the vertical and horizontal parts of the force vector of any given two objects. Now, if you have more than two objects interacting, you would do all of the above steps, and then add all of the horizontal and vertical parts. We can also convert back to a vector from this by doing Sqr(verticalpart^2 + horizontalpart^2) = force and arctan(verticalpart/horizontalpart) = angle.

Jpez, I realize you wanted to challenge him, but I don't think a 7th grader is going to be able to teach himself Newtonian physics and be able to implement it (no hard feelings Harq). I hope this is of some help.
Eh, it doesn't hurt to aim high. Razz
Well, there's still a little I didn't mention. Plus, it will be up to him to implement it. Smile
I was able to implement said engine in about 30 lines of code. It's not as difficult as it sounds.
Alright, let's see if he can do it Wink
At one point I had a fully functional gravitational simulator on my calculator, about 4k, that could take any initial positions, masses, and velocities and simulate movement. It did a pretty good simulation of the solar system, sun and 9 planets, including correctly predicting elliptical orbits. Too bad most of it got lost in a RAM clear. Sad I think I may have an early version backed up somewhere though.
Surprised Wow, that's impressive. Why didn't you put it on ticalc? Ram clear get to it before you could upload it, or did you have no intention of uploading it?
Oh no, I totally meant to upload it. I thought I transferred it to my computer, but then I couldn't find it when I looked for it. I went to my calc to retransfer, and realized I had gotten a RAM clear since I had finished it. Sad
See it's during those moments when Omnicalc is extremely useful. Or did this happen before Omnicalc?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement