From ff2c529dda20dba1ea7ef21f46703d59fb49178b Mon Sep 17 00:00:00 2001 From: nathansmithsmith Date: Thu, 21 Sep 2023 21:28:50 -0600 Subject: Better looking gyro --- src/entities/antifaShip.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/entities/antifaShip.c') diff --git a/src/entities/antifaShip.c b/src/entities/antifaShip.c index fb307fb..bd64545 100644 --- a/src/entities/antifaShip.c +++ b/src/entities/antifaShip.c @@ -29,6 +29,7 @@ void initAntifaShip(Entity * entity, Game * game) { AntifaShip * data = (AntifaShip*)entity->data; data->lastMouse = GetMousePosition(); data->forwardSpeed = 0.0; + data->shouldInitMousePosition = true; } void closeAntifaShip(Entity * entity) { @@ -77,6 +78,12 @@ void controlAntifaShipJoystick(Game * game, Entity * entity) { void controlAntifaShipKeyboardAndMouse(Game * game, Entity * entity) { AntifaShip * data = (AntifaShip*)entity->data; + // Resets mouse on init. + if (data->shouldInitMousePosition) { + data->shouldInitMousePosition = false; + SetMousePosition(0, 0); + } + // Get mouse values. Vector2 mouse = GetMousePosition(); float speed = GetMouseWheelMove(); -- cgit v1.2.3