23 |
24 |
25 | FULLSCREEN
26 |
27 |
28 |
29 | );
30 | };
31 |
32 | export default DevMenu;
--------------------------------------------------------------------------------
/www/src/game/components/Player/hooks/collisions.ts:
--------------------------------------------------------------------------------
1 | import {useProxy} from "valtio";
2 | import {playerVisualState} from "../components/PlayerVisuals/PlayerVisuals";
3 | import {useEffect} from "react";
4 | import {BodyApi} from "../../../../physics/components/Physics/hooks";
5 | import {COLLISION_FILTER_GROUPS} from "../../../../physics/collisions/filters";
6 |
7 | export const usePlayerCollisionsHandler = (api: BodyApi) => {
8 |
9 | const rolling = useProxy(playerVisualState).rolling
10 |
11 | useEffect(() => {
12 |
13 | // if (rolling) {
14 | // api.updateBody({
15 | // fixtureUpdate: {
16 | // maskBits: 0
17 | // }
18 | // })
19 | // } else {
20 | // api.updateBody({
21 | // fixtureUpdate: {
22 | // maskBits: COLLISION_FILTER_GROUPS.mob,
23 | // }
24 | // })
25 | // }
26 |
27 | }, [rolling])
28 |
29 | }
--------------------------------------------------------------------------------
/www/src/game/components/Joystick/Joystick.tsx:
--------------------------------------------------------------------------------
1 | import React, {useEffect, useRef} from "react";
2 | import nipplejs, {JoystickManager} from 'nipplejs';
3 | import styled from "styled-components";
4 |
5 | const StyledContainer = styled.div`
6 | position: absolute;
7 | top: 0;
8 | left: 0;
9 | right: 0;
10 | bottom: 0;
11 |
12 | .nipple {
13 | pointer-events: none;
14 | }
15 |
16 | `;
17 |
18 | export let nippleManager: JoystickManager;
19 |
20 | export const inputData = {
21 | lastTouchStart: 0,
22 | lastTouchEnd: 0,
23 | }
24 |
25 | const Joystick: React.FC = ({children}) => {
26 |
27 | const ref = useRef