Max Posted February 7, 2014 Share Posted February 7, 2014 Hi everybody! I heard of the awesome features in the new Phaser-release through Twitter yesterday, so I really wanted to play around with it a bit. I'm currently experimenting with a simple platformer (click to play). I'm using Phaser version 1.1.3. The ground is made up of multiple blocks:this.floorTiles = this.game.add.group();for (var i = 0; i < worldWidth; i += 64) { var brick = this.floorTiles.create(i, worldHeight - 32, 'brick'); brick.body.immovable = true; brick.body.allowGravity = false;}The player collides with them vertically just fine, but also horizontally if you start moving left. I know that this is a common problem with collision systems and each implementation/engine has its own way of going around this. How can I avoid this unwanted horizontal collision in Phaser? Also: I can't jump if I'm on the ground – jumping in the air works, though (press SPACE). Any idea on how to solve this aswell?if (this.cursors.jump.isDown && true) { this.body.velocity.y = -500;}Full code: game.js / player.js Thank you very much for your help. I'm enjoying Phaser quite a bit already, I just need a little help getting started. Thank you! Max Link to comment Share on other sites More sharing options...
rich Posted February 7, 2014 Share Posted February 7, 2014 Ah the classic toe-stubbing issue. Do you have to use sprites, rather than a tilemap? Link to comment Share on other sites More sharing options...
Max Posted February 7, 2014 Author Share Posted February 7, 2014 Hi Rich, thanks for the reply! I haven't settled yet on whether I want to use a tilemap or not. Ideally, I would like to find a solution for working with both sprites and tilemap. Max Link to comment Share on other sites More sharing options...
rafaholiveira Posted February 7, 2014 Share Posted February 7, 2014 For repeated sprites you can use TileSprites, but if the sprites will not change, I think the best option is tilemaps. Link to comment Share on other sites More sharing options...
Max Posted February 8, 2014 Author Share Posted February 8, 2014 Hey rafaholiveira, thanks for your help. I checked the documentation for TileSprites but it unfortunately does not look like it's an option because I need each block to stuff individually. I want to make single blocks disappear or move up and down. Does the tilemap allow for this sort of behavior while preventing the toe-stubbing? Thanks,Max Link to comment Share on other sites More sharing options...
Max Posted February 9, 2014 Author Share Posted February 9, 2014 Hi again, I just wanted to let you know that I updated to 1.1.4 and the toe-stubbing issue seems to be resolved for now. Thanks for your help! Link to comment Share on other sites More sharing options...
Recommended Posts