feat:(game) added a reset button to avoid reload

This commit is contained in:
Alex committed 2024-02-02 11:41:44 +01:00
1 parent f22f19590d
commit 51c2f3f8f8
1 file changed
+6
+6
View File
@@ -32,6 +32,7 @@ export const PlayerController = () => {
const rightPressed = useKeyboardControls((state) => state[Controls.right]); const rightPressed = useKeyboardControls((state) => state[Controls.right]);
const jumpPressed = useKeyboardControls((state) => state[Controls.jump]); const jumpPressed = useKeyboardControls((state) => state[Controls.jump]);
const shootPressed = useKeyboardControls((state) => state[Controls.shoot]); const shootPressed = useKeyboardControls((state) => state[Controls.shoot]);
const resetPressed = useKeyboardControls((state) => state[Controls.reset]);
const [isOnGround, setIsOnGround] = useState(false); const [isOnGround, setIsOnGround] = useState(false);
const body = useRef(); const body = useRef();
@@ -394,6 +395,11 @@ export const PlayerController = () => {
// MISC // MISC
if(resetPressed) {
body.current.setTranslation({x: 8, y: 2, z: -119});
}
// ITEMS // ITEMS