From 51c2f3f8f8c358193362f337755a167c110a2b22 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 2 Feb 2024 11:41:44 +0100 Subject: [PATCH] feat:(game) added a reset button to avoid reload --- src/components/PlayerController.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/PlayerController.jsx b/src/components/PlayerController.jsx index 70edc1c..17b789e 100644 --- a/src/components/PlayerController.jsx +++ b/src/components/PlayerController.jsx @@ -32,6 +32,7 @@ export const PlayerController = () => { const rightPressed = useKeyboardControls((state) => state[Controls.right]); const jumpPressed = useKeyboardControls((state) => state[Controls.jump]); const shootPressed = useKeyboardControls((state) => state[Controls.shoot]); + const resetPressed = useKeyboardControls((state) => state[Controls.reset]); const [isOnGround, setIsOnGround] = useState(false); const body = useRef(); @@ -394,6 +395,11 @@ export const PlayerController = () => { // MISC + if(resetPressed) { + body.current.setTranslation({x: 8, y: 2, z: -119}); + } + + // ITEMS