At the moment I have this code which fires a projectile:
Vector3 d = mousePos.sub(pouchPos.x, pouchPos.y, 0);
d.mul(FIRE_SPEED);
projectile.setVelocity(-d.x, -d.y);
Which works fine, and this which sets the position according to the mouse position:
turtle.body.setTransform(mousePos.x, mousePos.y, 0);
if (turtle.pos.dst(pouchPos) > 5)
{
//What to put in here?
}
Trouble is I don’t know what to put in the if (turtle.pos.dst(pouchPos) > 5) clause. What would you suggest?
1 Answer