Jump to content

My first 'multiple-state-game' and errors with time and fullscreen


carlos95
 Share

Recommended Posts

Hello,

I post in this forum because i need help with 4 lines of code that doesnt work in my game.js file. The similiraty of this 4 lines is that the last method parameter is a this. In the phaser-examples they say that this parameter is: "the context under which that will happen", leaving it as a 'this'. Well, i dont know if thats the real problem or there is something im not realising.

 

 

Here i leave the lines of code found in the create function that doesnt work (the rest of it do work perfectly when I deleate the lines):

 

    // The camera follows the player
    this.camera.follow(player);

    // ----------- error-------------
    // The timer. After 20 seconds its game over.
    // this.time.events.add(Phaser.Timer.SECOND * 20, gameOver,this)
    
    // full screen
    this.stage.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT;
    
    // -----------error---------------
    // this.input.onDown.add(fullScreen, this);
    
    //-----------error----------------
    // We create a body specific callback
    // player.body.createBodyCallback(paper, hitPaper, this);
    
    // Turn on impact events for the world.
     this.physics.p2.setImpactEvents(true);

 

Thank you very much :)

 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...