The Daily Click ::. Forums ::. Klik Coding Help ::. Another math question
 

Post Reply  Post Oekaki 
 

Posted By Message

bhlaab



Registered
  19/06/2002
Points
  73
26th May, 2007 at 13:46:05 -

I have it so an enemy is hurled at the player using a bouncing ball movement. I want the initial speed to remain constant (for fairness), but the deacceleration to adjust so that the enemy will be stopped at roughly the same point behind the player (if they're standing still)

what's the formula I should use as "set deacceleration to"

 
n/a

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
26th May, 2007 at 14:13:21 -

Rather than set the deceleration you might want to work out the distance between the player and the enemy, and use that to set the speed. That way the closer the enemy gets, the slower it becomes.

 
n/a

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
26th May, 2007 at 14:14:20 -

v = u + 2as
v = u + at
s = ut + 0.5at
s = 0.5(v+u)t

V is final velocity

U is initial velocity

A is acceleration

S is displacement (i.e distance between start and end point)

T is time in motion
Unless it is projected in a straight line, horizontally or vertically, it isn't straight forward, as you need to consider each component of motion seperately.

If it is projected at an angle α relative to the horizontal,

Initial velocities will be for x: ucosα
and for y: usinα
where u is the SPEED of projection (speed = resultant of the velocities)

vertically, if projected upwards, acceleration is -9.81 (or -the value of gravity. it is negative because it is projected AWAY from the direction gravity pulls in)

Horizontally, the velcity does not change.

Hope this helps.

 
My signature is never too big!!!

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
26th May, 2007 at 15:27:33 -

Lol, physics overkill.

 
n/a

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
26th May, 2007 at 15:32:00 -

Mechanics.

But it is also used in physics.

I should probably do an article on mathematical forumlae, seeing as people as way too much about them.

Image Edited by the Author.

 
My signature is never too big!!!

BROO



Registered
  31/10/2002
Points
  595
26th May, 2007 at 15:53:17 -

Physics, but it is also used in mechanics.

So nice someone here knows math. :---). But... will it help?

 
n/a

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
26th May, 2007 at 16:47:41 -

Yes.

 
My signature is never too big!!!

BROO



Registered
  31/10/2002
Points
  595
26th May, 2007 at 17:26:58 -

Speed proportional to distance, as Klikmaster said: simple and good enough. :---).

 
n/a
   

Post Reply



 



Advertisement

Worth A Click