The Daily Click ::. Forums ::. Klik Coding Help ::. Moving Objects with Acceleration
 

Post Reply  Post Oekaki 
 

Posted By Message

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
13th May, 2005 at 19:57:15 -

Another question from me today..

In a project I'm currently working on, I want objects to be able to move from point a to point b. The MoveIt object is very good for this, but it doesnt support any acceleration or decelleration. I want the object start at point a, accelerate to its top speed, then it would decellerate to a stop at point b. (The object comes to rest at point b)

How can I do this without complicating things too much?

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
13th May, 2005 at 20:07:55 -

As for normal acceleration, create a counter and have some code like this:

Repeat while space is pressed - Add to counter 1

Repeat while space is not pressed - Subtract 1 from counter
+Counter > 1

Always set active1.x to active1.x + counter.value

As for making it stop on an exact position, I think this is the link to an example called "No overshooting target":
http://www.clickteam.com/CTforum/showflat.php3?Cat=&Board=upload&Number=154911&page=&view=&sb=&o=&vc=1
Direct:
http://www.clickteam.com/mbfiles2/154911-No%20Overshooting%20Target.cca

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
13th May, 2005 at 20:51:08 -

hmm..
Well, I want this movement more for enemies..

Ill have a look over this example nonetheless...

EDIT:
Whoa. It seems the MoveIt! extension has a small problem. In my situation, I have 9 possible nodes an object can move it. A node is picked at random, and MoveIt moves to the node. I discovered that if the object picked at random is the one that the object is already at, then the application has an illegal operation and crashes.
It seems when trying to move something with MoveIt to a spot that its already at, destroys the app. =/

Image Edited by the Author.

 
n/a

Airflow

imafirinmahlazr

Registered
  24/09/2003
Points
  -197

VIP MemberSonic SpeedSnow Cloud!Computer
14th May, 2005 at 01:27:40 -

Are you using fastloop to cycle through which enemy to move?

If you do it that way, you should be able to make it so that it only moves thae enemy when their speed(velocity if it pleases) is greater then zero.

 
n/a

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
14th May, 2005 at 02:14:33 -

Uh, I dont follow that last post.

I havent necessarily done any of the coding for that part yet, I only have an idea of how I want it to be. When an enemy moves from point a to point b, I just dont want it to travel a constant speed. I want to accelerate and decelerate. Thats pretty much it.

Ignore the whole thing about MoveIt crashing in my previous post, thats not a part of what I want to do.

 
n/a

guri-n ha



Registered
  16/04/2005
Points
  245
14th May, 2005 at 03:22:27 -

I found an example for it and it's hosted on my site, take a look:

http://www.opaque-sense.com/randomstuff/Accelerate.zip

 
n/a
   

Post Reply



 



Advertisement

Worth A Click