Comments (3)
I need more information to be able to help you.
from enable3d.
i am making this really big game
const config: Phaser.Types.Core.GameConfig = {
type: Phaser.WEBGL,
transparent: true,
parent: this.gameContainer.nativeElement,
scale: {
mode: Phaser.Scale.FIT,
autoCenter: Phaser.Scale.CENTER_BOTH,
width: 1280,
height: 720
},
scene: [
LoadingScene,
MenueScene,
CharaterScene,
GameOverScene,
GameScene,
MainScene,
TypingScene,
BingoScene,
MatchingScene,
MemoryMatchingScene,
WordLadderScene,
WordSearchScene,
WordScrambleScene,
WordCrosswordPuzzleScene,
WordHangmanScene
],
...Canvas()
}
var game = new Game(config);
enable3d(() => game).withPhysics('assets/ammo') and
import { GameObjects, Scene } from 'phaser';
import { sceneNames } from '..';
import { imagefiles, imageNames } from '../class/image';
import { soundfiles } from '../class/sound';
export class LoadingScene extends Scene {
progressBar!: GameObjects.Graphics;
loadingScreen!: GameObjects.Image ;
constructor() {
super({ key: sceneNames.LoadingScene });
}
preload() {
// Load the loading screen background image
this.load.image(imagefiles[0].id, imagefiles[0].src);
}
create() {
// Create the loading screen background image
this.loadingScreen= this.add.image(0, 0, imageNames.logo).setOrigin(0);
this.progressBar = this.add.graphics();
// Load all the assets
for (var i = 0; i < imagefiles.length; i++) {
this.load.image(imagefiles[i].id, imagefiles[i].src);
}
// ... Load all the other assets here ...
for (var i = 0; i < soundfiles.length; i++) {
var soundfile = soundfiles[i];
this.load.audio(soundfile.name, [soundfile.ogg, soundfile.mp3]);
}
// Set up callbacks for asset loading progress
this.load.on('progress', this.onLoadProgress, this);
this.load.on('complete', this.onLoadComplete, this);
// Start the asset loading process
this.load.start();
this.scale.displaySize.setAspectRatio(4 / 3);
this.scale.refresh();
}
onLoadProgress(progress: number) {
// Update the progress bar or other loading indicator
this.progressBar.clear();
this.progressBar.fillStyle(0xffffff, 1);
this.progressBar.fillRect(212, 600, 600 * progress, 40);
}
onLoadComplete() {
this.scene.start(sceneNames.CharaterScene);
}
}
go to the CharaterScene just fine then import { ExtendedObject3D, JoyStick,
PointerDrag, PointerLock, Scene3D, ThirdPersonControls,
THREE } from '@enable3d/phaser-extension';
import { isTouchDevice, phaserEvents, sceneNames } from '..';
import Keyboard from '../containers/keyboard';
import { Player } from '../containers/player';
import PlayerOptions from '../containers/playerOptions';
export class CharaterScene extends Scene3D {
canJump: boolean = false;
isJumping: boolean = false;
move: boolean = false;
moveTop!: number;
moveRight!: number;
robot!: Player;
playerOptions!: PlayerOptions;
controls: any;
constructor() {
super({ key: sceneNames.CharaterScene });
}
init() {
this.accessThirdDimension()
this.canJump = true
this.isJumping = false
this.move = false
this.moveTop = 0
this.moveRight = 0
}
create() {
this.third.warpSpeed('camera', 'sky', 'grid', 'ground', 'light')
this.third.load.gltf('assets/glb/robot.glb').then(object => {
this.robot=new Player(object, this);
this.robot.position.set(-5,0,-2);
})
this.playerOptions=new PlayerOptions (this,640, 0);
this.add.existing(this.playerOptions);
this.playerOptions.startButton.rectangle.on(phaserEvents.pointerdown,
this.startGame);
}
startGame(){
this.scene.stop(sceneNames.CharaterScene);
this.scene.start(sceneNames.GameScene);
}
}
shen i click the start game button i get this.scene.stop dose not work in chrome when i do this.scene.startt(sceneNames.GameScene) it still errors
from enable3d.
acidently closed help
from enable3d.
Related Issues (20)
- physicsWorld.getWorldInfo() is not function inside @enable3d/ammo-physics HOT 6
- React JS doesn't support Enable3d HOT 2
- React JS doesn't support Enable3d HOT 2
- AmmoPhysics Error: abort(OOM). HOT 2
- Wrong typings? HOT 2
- The error that "require" cannot be used in rollup packaging occurs! HOT 5
- ObjectLoader does not work when used after preloading model files HOT 10
- Crash Loading 3D Heightmap from PNG Example HOT 3
- Hello, I found a problem. Physical objects shake constantly during falling. How did this problem come about? HOT 2
- svg , other shapes then concave ? HOT 1
- Joystick on typescript in Phaser extension HOT 1
- Hide Powered by Enable3D? HOT 1
- Does Enable3D support Inverse Kinematics (IK)?
- shape='box' Add rigid body, why my rigid body is bigger than the actual object, I don't know what's wrong. HOT 13
- I tried to pick-up objects and it didn't work out. HOT 4
- Uncaught RuntimeError: abort(OOM).
- In this example, pressing the A and D buttons has no effect! HOT 1
- THANK YOU FOR CREATING ENABLE3D!
- Removing physics object unlinks visuals and physics HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enable3d.