JHenriP

Members
  • Content Count

    4
  • Joined

  • Last visited

About JHenriP

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. JHenriP

    Text Input

    Hi again, it's been a while. I've been working on a game for college which I'll share later on (it's almost finished!! ) but for now I'm stuck with receiving inputs from the user to be used in the highscores.. Is there any method, and if there isn't what's the best work around? Thanks in advance
  2. Hi everyone, as someone new to Phaser I came across the question most of us (newbies) have after a few hours experimenting.. Am I doing it right?! Obviously there's never only one "right way" of doing things, after watching a few tutorials I ended up with the code below. I'm looking for a feedback in the following topics: Classes - If I am not mistaken I've probably tried 3 differents ways of making classes, this one was the most logical to my eyes. (I'm refering to classes which I want to use as scenes) Var vs this. - Is there any difference? I see people using var x and this.x (I assume I can also use let instead of var since I'm always on the same block) Starting a new scene - This is the part I am really confused about, I have menuNumber initialized in another .js and basically I'm waiting for a pointerdown event to happen in one of the images to then change menuNumber value that will be read through update() since it's an infinite loop in order to start a new scene. Note: Everything is working fine and I'm preloading all the images in another .js file class MainMenu extends Phaser.Scene { constructor() { super({key: "MainMenu"}); } create() { this.add.image(640, 320, "background"); //var title = this.add.image(200, 200, "title"); reduce png size var jogarBut = this.add.image(960, 120, "jogarBut").setInteractive(); var opcoesBut = this.add.image(960, 180, "opcoesBut").setInteractive(); var ajudaBut = this.add.image(960, 240, "ajudaBut").setInteractive(); var rankingBut = this.add.image(960, 300, "rankingBut").setInteractive(); var creditosBut = this.add.image(960, 360, "creditosBut").setInteractive(); var sairBut = this.add.image(960, 420, "sairBut").setInteractive(); //Click on title easter egg - to do menuNumber = -1; jogarBut.on("pointerdown", function (ev) { menuNumber = 0; }); opcoesBut.on("pointerdown", function (ev) { menuNumber = 1; }); ajudaBut.on("pointerdown", function (ev) { menuNumber = 2; }); rankingBut.on("pointerdown", function (ev) { menuNumber = 3; }); creditosBut.on("pointerdown", function (ev) { menuNumber = 4; }); sairBut.on("pointerdown", function (ev) { menuNumber = 5; }); } update() { if(menuNumber===0){ this.scene.start("Jogar"); } else if (menuNumber===1){ this.scene.start("OpcoesMenu"); } else if (menuNumber===2){ this.scene.start("AjudaMenu"); } else if (menuNumber===3){ this.scene.start("RankingMenu"); } else if (menuNumber===4){ this.scene.start("CreditosMenu"); } else if (menuNumber===5){ this.scene.start(""); } } }
  3. I started over and everything is working fine now! (Still don't know what caused the error) Thanks for the time!
  4. Hello, setInteractive seems to not be working, at first I thought I wasn't using it correctly (I'm a Phaser and JS newbie ) but then I even tried this example and the same error is being displayed. I'm using the latest Phaser version, everything else I tried is working fine. Sreenshot of the folder project: