Skip to content

Commit 29e2459

Browse files
author
gamedevgrunt
committed
Add mobile support
1 parent a2547c2 commit 29e2459

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎index.html‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
<head>
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
67
<title>RPG Level Builder</title>
78

89
<style>
@@ -35,6 +36,7 @@
3536
position: absolute;
3637
bottom: 20px;
3738
left: 50%;
39+
width: 100%;
3840
transform: translateX(-50%);
3941
display: flex;
4042
justify-content: center;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export function setupMainPlayerMenu(scene) {
2+
// Set up right-click event listener
3+
// console.log(hero);
4+
scene.onPointerObservable.add((pointerInfo) => {
5+
if (pointerInfo.type === BABYLON.PointerEventTypes.POINTERDOWN && pointerInfo.event.button === 2) {
6+
// Right mouse button clicked
7+
const pickResult = scene.pick(scene.pointerX, scene.pointerY);
8+
9+
if (pickResult.hit) {
10+
const pickedMesh = pickResult.pickedMesh;
11+
12+
if (pickedMesh.name === 'dummyPhysicsRoot') {
13+
console.log("clicked player");
14+
}
15+
}
16+
}
17+
}, BABYLON.PointerEventTypes.POINTERDOWN);
18+
}

‎src/movement.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { SPELLS } from './combat/SPELLS.js';
22

33
export function setupInputHandling(scene, character, camera, hero, anim, engine, dummyAggregate) {
4-
let inputMap = {};
4+
inputMap = {};
55
scene.actionManager = new BABYLON.ActionManager(scene);
66
scene.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnKeyDownTrigger, function (evt) {
77
var key = evt.sourceEvent.key;

0 commit comments

Comments
 (0)