Jump to content

Wierd issue in a simple code. Changing player position from (x:10, y:10) to (x:50, y:50) is not working. DoorA to DoorB simple gameplay


Recommended Posts

I have uploaded it to http://castle9.site44.com/ and would appreciate it if you can check the source files in browser developer tools as I am at work and uploading all the stuff to a host to use in codepen takes a lot more time. 


Anyways, code is very simple. There are two doors and when the player touches the door1 at bottom, he should be placed at door2 at top. Simple. But its not happening and no errors. 


    this.door1.body.collides(this.playerCollisionGroup, this.door1leads, this);
    door1leads: function(){//        a.sprite.x = 900;//        this.player.position = this.door2.position;                  //        this.player.position.x = this.door2.position.x;//        this.player.position.y = this.door2.position.y;        this.player.x = this.door2.x;        this.player.y = this.door2.y;//        this.player.y = 100;        console.log("hi");    },    
nothing works really. Pls help
Link to comment
Share on other sites


  • Recently Browsing   0 members

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