This site requires JavaScript, please enable it in your browser!
Greenfoot back
Razzo
Razzo wrote ...

2012/10/11

Boomerang Arcs!

Razzo Razzo

2012/10/11

#
Okay, So I have an Object "Boomerang" and I need to have an 2Darray of all the x and y coordinates on an arc between 2 points. Like this So then I can make the boomerang go to each point in the 2Darray, making a fluid movement. How would I get the 2DArray from the 2 Points?
MatheMagician MatheMagician

2012/10/11

#
If you just want to make an actor go in an arc, there are much simpler ways for doing it (i.e. nccb's monkey scenario is a good example).
Razzo Razzo

2012/10/11

#
That's helped me alot, But with his Scenario, he just makes it go up, and then gravity affects it to make it arc. Whereas my game will be looking from top-down. So gravity isnt involved...
Razzo Razzo

2012/10/11

#
Yeah, after trying to mess about with it, I didn't get it working.
MatheMagician MatheMagician

2012/10/11

#
Yes, however, if you are still making an arc, the principle is the same: start out in one direction and then change it every act with some force. If you tell me more specifically what you are trying to do, then I think I could be more help.
Razzo Razzo

2012/10/11

#
Okay, let me publish my game so far. Link I want the Boomerangs to "curve" to the point (Where you click) and then curve back to the player.
MatheMagician MatheMagician

2012/10/11

#
Cool idea! It shouldn't be terribly hard. Do you want it to travel in a circle or more of an elliptical pattern.
Razzo Razzo

2012/10/11

#
If circle is easier, I'll do that, but Preferably an Elliptical pattern. :D
Razzo Razzo

2012/10/11

#
I still can't work it out. Any ideas?
SPower SPower

2012/10/11

#
Razzo Razzo

2012/10/11

#
I've got it working, It's just I need 1 more bit of math, Basicly, I have the x and y for the point where it rotates, but I need the point to be 2 times closer. So the actual boomerang will hit it, It's hard to explain so I will update my game, Just click where the boomerang should hit, and you will see what happens. Here
danpost danpost

2012/10/11

#
Instead of circling around mouse.getX() and mouse.getY(), you need to circle around the average of the two points (mouse.getX() + getX()) / 2 and (mouse.getY() + getY()) / 2
You need to login to post a reply.