Skip to content

Commit

Permalink
Merge pull request #401 from BIDMCDigitalPsychiatry/gyroscope-game
Browse files Browse the repository at this point in the history
Gyroscope updates
  • Loading branch information
sarithapillai8 authored Sep 30, 2024
2 parents 30dfee5 + fbcbe83 commit 1374d5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Gyroscope/src/containers/GameComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export function GameComponent({ ...props }) {
window.removeEventListener("devicemotion", handleAcceleration);
};
}
}, [speed]);
}, [speed, lastUpdate]);

const getTargetPostion = (centerX, centerY) => {
const ctx = canvasRef.current.getContext("2d");
Expand Down Expand Up @@ -244,7 +244,7 @@ export function GameComponent({ ...props }) {

const handleAcceleration = (event) => {
const currentTime = Date.now();
if (currentTime - lastUpdate > 100) {
if (currentTime - lastUpdate > 50) {
let landscape = stateValues?.landscape;
let rotation = event.rotationRate || 0;
var x = event.accelerationIncludingGravity.x;
Expand Down

0 comments on commit 1374d5a

Please sign in to comment.