Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
How to make a object move with a acceleration
Old
git_kid
Guest
 
Status:
Posts: n/a
Default How to make a object move with a acceleration - 03-31-2010, 11:33 PM

I want to make a racing project, but I don't know how to make cars move with accelerations. Please help, thanks very much
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 04-01-2010, 08:54 AM

Um accelerations. Just make a car move forward normaly with 1 button, then make another button while its being held down the car moves forward again and it will double the speed if that one is faster than the other speed


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 04-02-2010, 12:53 AM

git_kid, do you know physics? If you do, you should be able to have the cars move according to the kinematic equation

V^2 = Vo^2+2aX (X being delta X, of course).

this allows you to have the car start slowly from zero and gradually work up to greater speeds (with the amount of speed gained increasing) as the key is held down.

If you need a simpler explanation, let me know.


(')>
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 04-02-2010, 01:45 AM

Quote:
Originally Posted by x2495iiii View Post
git_kid, do you know physics? If you do, you should be able to have the cars move according to the kinematic equation

V^2 = Vo^2+2aX (X being delta X, of course).

this allows you to have the car start slowly from zero and gradually work up to greater speeds (with the amount of speed gained increasing) as the key is held down.

If you need a simpler explanation, let me know.
I'm not sure where you got that equation, but it's not entirely correct.

It should be: Vf²=Vi²+2ad
Where Vf is final velocity, Vi is the initial velocity, a is acceleration and d is distance (equation isn't supposed to include Δ).

A "while key is pressed" event can be used with a method telling the car to move at X speed, where X would be a function with the parameters 'd', 'a' and 'Vi' (Vi would need something to tell what the current speed of the car is) and would return the value of:

√(Vi²+2ad)

If you don't know advanced math symbols, then ignore the rest of this post, otherwise, use this equation as the parameter in the "move at speed X" and have it loop every second until the final distance is met:

d
∑(√(Vi²+2an))
n=0

d = distance travelled
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default 04-04-2010, 02:22 PM

Just have the object move at speed x, a world variable, and then, when you want it to speed up, increase that variable. When you use lengths of time for variable changes, it does a smooth change. Just be sure to change the style to abruptly!


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
dubastot
Senior Member
 
dubastot's Avatar
 
Status: Offline
Posts: 661
Join Date: Apr 2009
Location: Two Steps From Hell
Default 04-04-2010, 10:44 PM

And don't forget to make another variable to limit your speed so the car doesn't move to fast. You will need an if/else statement for that.


I'm a web developer/ designer now.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 04-06-2010, 09:53 AM

Quote:
Originally Posted by Niteshifter View Post
It should be: Vf²=Vi²+2ad
Where Vf is final velocity, Vi is the initial velocity, a is acceleration and d is distance (equation isn't supposed to include Δ).
Same equation, actually (though bravo on getting the delta to show up).

Delta X means the change in distance, so it is often worded as Delta x, not d (it was in my AP Physics textbook).

Same thing for the V's. V implicitly means final velocity, while Vo ("V aught"), means initial velocity.

In other words, my equation was just as correct as yours, just harder to read.

Quote:
Originally Posted by reuben2011 View Post
Both equations are essentially the same. They just use different letters for the variables. In X's equation V is assumed to be Vf and Vo is assumed to be Vi ("0" as in zero/initial/beginning). X is better because you are looking for a displacement, not a distance (d). And of course it is delta X because it is the change in displacement. The delta is used just in case the initial X does not start at zero. I hope this clears some things up. Yes, I am taking a physics class this year.
Didn't think anyone would catch that but me, thanks reuben2011! Seems a shame to delete my nice response, though, so I'm keeping it.


(')>

Last edited by x2495iiii; 04-06-2010 at 09:57 AM.
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 04-13-2010, 11:03 PM

Quote:
Originally Posted by x2495iiii View Post
Same equation, actually (though bravo on getting the delta to show up).

Delta X means the change in distance, so it is often worded as Delta x, not d (it was in my AP Physics textbook).

Same thing for the V's. V implicitly means final velocity, while Vo ("V aught"), means initial velocity.

In other words, my equation was just as correct as yours, just harder to read.
I'm too used to seeing displacement as a different character set which is why I messed that up (too close-minded of me ). Yours works better for explanation though. My sigma equation is essentially a result of too much calculus
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.