feat:(game) added a reset button to avoid reload
parent
f22f19590d
commit
51c2f3f8f8
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue