jumpTo engine

hey all,

I wanna make a simple (as possible) jump engine that makes jumps with a curve and at the position of a ring Object _y it jumps higer or lower…

take a look at a demo pic…

ps its a quick and dirty drawing :))

Cheers,

M

So you want that fish tu jump trough a center of a ring, right?

No testing, no guarantee, but anyway here you go:

Lets look at this picture…

  1. You choose random point, as a center of the circle.
  2. Calculate radius
  3. Find starting position
  4. Move fish along its path

Now lets start implementing =)

  1. Thats easy :wink:
  2. In Flash 8, you can just use point class
var circleCenter:Point = new Point(300, 100);
var randPoint:Point = new Point(200, 0);
var radius:Number = Point.distance(circleCenter, randPoint);
// without flash 8 Pythagorean theorem will do
circleCenter = [300,100];
randPoint = [200, 0];
a = circleCenter[0]-randPoint[0];
b = circleCenter[1]-randPoint[1];
radius = Math.sqrt(a*a + b*b)
  1. Thats just… well, lets make it possible to jump from both directions
// flash 8 solution
var startPoint:Point = new Point();
startPoint.x = (circleCenter.x-randPoint.x > 0) ? randPoint.x+radius : randPoint.x-radius;
// non-flash 8
startPoint = (circleCenter[0]-randPoint[0] > 0) ? randPoint[0]+radius : randPoint[0]-radius;
  1. Sorry, I dont have much time right now, but you should be able to figure the rest by yourself. Look at Sen’s tutorial about 3D here at kirupa… there is a section about trigonometry and about movement on a circle (link) Good luck. If you need something, ill be back later =)

hm thanks but still need some help here…

now i have the starting point…ok… and now i try to move it but what is the angle… i calculate it…

i am also trying to make the fish from startposition the _rotation=0 and i want it to be at the higest point… _rotation= -90 so its rotating along…

i try to make it work…

hm thanks but still need some help here…

now i have the starting point…ok… and now i try to move it but what is the angle… i calculate it…

i am also trying to make the fish from startposition the _rotation=0 and i want it to be at the higest point… _rotation= -90 so its rotating along…

i try to make it work…