Steer fly carrot with mouse

Version:

1.0

Added on:

03 Feb 2015 21:27

Tags:

Description:
As with any mouse-based code, doesn't work so well in splitscreen or 3D.
void onPlayer(jjPLAYER@ play) {
  if (play.fly == FLIGHT::FLYCARROT) {
    play.ySpeed = (jjMouseY + play.cameraY - play.yPos) / 8; //adjust "8" until you get a speed/distance ratio that feels right to you
    play.xSpeed = (jjMouseX + play.cameraX - play.xPos) / 8;
    play.direction = (play.xPos > jjMouseX + play.cameraX) ? -1 : 1;
  }
}