Implement swinging behaviour with velocity?

23 views
Skip to first unread message

Jeru Sanders

unread,
Nov 13, 2015, 3:51:24 PM11/13/15
to haxef...@googlegroups.com
Hello all, I'm trying to create a swinging effect for a grappling hook in my game I know how to do the maths and there's an example here(click near the top of screen to fire grappling hook, you must refresh to try again), and I'm doing it with this code.

The problem is that when doing thing I'm modifying the x and y coordinates directly meaning I forfeit of collision detection. Does anyone have an idea of how I could do the same thing but with velocity?

I've tried using FlxVelocity.moveTowardsPoint(), but it doesn't move in an arc so if it doesn't make it all the way to the point(which it won't) it will be slightly closer to the top and thus make a curving path up.

EDIT: Fixed the imgur link.

Jeru Sanders

unread,
Nov 13, 2015, 5:10:41 PM11/13/15
to HaxeFlixel
Whoops, should have thought about that a little bit more, the solution is to make a separate point, apply the physics to it, then have the player constantly move towards that point.
Reply all
Reply to author
Forward
0 new messages