lucasg07 Posted November 17, 2018 Share Posted November 17, 2018 Hi, I'm really really really new to Phaser and for school we need to make a game in only 2 weeks. I'm making a game based on doodle jump. I searched a long time for some examples but I can only find Phaser 2 examples. This makes it really hard for me to actually understand Phaser 3. I'm learning it with very small steps but can't seem to understand why I'm getting this error: //preload class: I tried both spritesheet and image this.load.spritesheet(`tile`, `./assets/tile.png`,{ frameWidth: 32, frameHeight: 48 }); //this is a copied Phaser 2 example that I'm trying to convert platformsCreateOne(x, y, width) { //When a tile leaves the screen - returns a sprite with false property const platform = this.platforms.getFirstDead({ key: 'tile' }); //I added this myself because the sprite didn't have a body, not sure if this is correct platform.body = true; console.log(platform); //returns a sprite console.log(platform.body); //returns true //told me that platform.reset is not a function, agian not sure if this is correct, not even sure why i use .physics.body guess I just tried something I saw online, again i'm really new to phaser platform.physics.body.reset(x, y); //returns error "Cannot read property 'body' of undefined" //also tried this /*platform.physics.body.reset({ x: x, y: y });*/ platform.scale.x = width; platform.scale.y = 16; platform.body.immovable = true; return platform; } Link to comment Share on other sites More sharing options...
lucasg07 Posted November 17, 2018 Author Share Posted November 17, 2018 Edit: not sure why //comments are displayed wrong. It displays right while creating it. Link to comment Share on other sites More sharing options...
samme Posted November 18, 2018 Share Posted November 18, 2018 I would avoid the Phaser 2 examples for now because it will just make it more confusing to learn. Did you do Making your first Phaser 3 game? That will get you started with physics, which is what your example is missing. Link to comment Share on other sites More sharing options...
Recommended Posts