Coder Social home page Coder Social logo

Comments (3)

yandeu avatar yandeu commented on June 10, 2024

I need more information to be able to help you.

from enable3d.

jenniferschofi avatar jenniferschofi commented on June 10, 2024

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.

jenniferschofi avatar jenniferschofi commented on June 10, 2024

acidently closed help

from enable3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.