StuffBySpencer Posted April 15, 2014 Share Posted April 15, 2014 I need help with creating tilemaps. I use tiled to create the maps, however it seems that tiled is counting my tileset image starting at 1, while phaser counts tilesets starting from 0. Because of this, whenever I make a tilemap, the blocks are out of order, and the map looks all screwey.Please help, I have attached an image to better explain this: Link to comment Share on other sites More sharing options...
clark Posted April 15, 2014 Share Posted April 15, 2014 Ahh yeah, this was familiar to me too. I used the Ninja Template Tiles but I got this same issue. Link to comment Share on other sites More sharing options...
StuffBySpencer Posted April 15, 2014 Author Share Posted April 15, 2014 Anyway you know how to fix it? Link to comment Share on other sites More sharing options...
StuffBySpencer Posted April 16, 2014 Author Share Posted April 16, 2014 Also, sometimes the player randomly falls through the tiles. I recorded a section of it, with debug on, and paused the video at a point where I think there could be a problem, the collision debug box 'lags' behind and doesn't render around the playyer as he falls, leaving his feet exposed. Link to comment Share on other sites More sharing options...
StuffBySpencer Posted April 16, 2014 Author Share Posted April 16, 2014 ok, so I fixed the first issue by changing the addTilesetImage() parameters (the first needs to be the tileset name tiled used) But I'm still having really buggy issues with collision where the player randomly falls through blocks, even though he should collide with them :/ Link to comment Share on other sites More sharing options...
Raikoh Posted April 16, 2014 Share Posted April 16, 2014 I have the collision issue too, for me it happens when the game lags/spikes, it doesn't happen a lot tho so it's not such a big issue for me. Link to comment Share on other sites More sharing options...
rich Posted April 16, 2014 Share Posted April 16, 2014 You can mitigate the spike issue using the deltaCap: http://www.html5gamedevs.com/topic/5522-phaser-202-arcade-physics-bug/?hl=deltacap#entry33323 Link to comment Share on other sites More sharing options...
StuffBySpencer Posted April 18, 2014 Author Share Posted April 18, 2014 the deltaCap hasn't helped with my collision issue at all, the player still falls through tiles randomly :/ Link to comment Share on other sites More sharing options...
rich Posted April 18, 2014 Share Posted April 18, 2014 What values are you using for gravity, velocity, etc? If your sprite is moving too fast it will penetrate too far into the tile and pop out the other side, passing right through it. Link to comment Share on other sites More sharing options...
StuffBySpencer Posted April 20, 2014 Author Share Posted April 20, 2014 I am using a pretty heavy gravity (1400) Could you recommend a better way to make the jumping less 'floaty'?Because with a gravity at 1000 or less, the player tends to 'hang' in the air a little bit, but I'm looking for more of a fast jump, more tight and less time in the air. Link to comment Share on other sites More sharing options...
rich Posted April 22, 2014 Share Posted April 22, 2014 Wow that's huge. What are you using for vertical velocity? Link to comment Share on other sites More sharing options...
ema9 Posted April 23, 2014 Share Posted April 23, 2014 Hi rich, i have the same first problema with mapeditor and phaser. but i cant find solution. Link to comment Share on other sites More sharing options...
StuffBySpencer Posted April 23, 2014 Author Share Posted April 23, 2014 my vertical velocity is 500. The problem is with gravity and velocity lower than this, the player hangs in the air a little and it feels a little floaty. I'm trying to get more, fast, 'clean' movement where he jumps up, and immediately starts to fall back down. Link to comment Share on other sites More sharing options...
drhayes Posted April 24, 2014 Share Posted April 24, 2014 Hey, just popping into this thread because, apparently, I have a huge gravity too: 1800. I have exactly IAmSpencer's problem. Lower values make the player movement feel floaty and, yes, sometimes I get wacky "fall through the tile" or "jump really high" problems. Link to comment Share on other sites More sharing options...
Martti Laine Posted April 24, 2014 Share Posted April 24, 2014 Wouldn't it help to set a maximum velocity for vertical movement?player.body.maxVelocity.setTo(300, 500);Values are horizontal and vertical movement, respectively. Should adjust these to match your game physics. Link to comment Share on other sites More sharing options...
rich Posted April 26, 2014 Share Posted April 26, 2014 This gives me a nice short snappy jump. Jump velocity is -500: game.physics.arcade.gravity.y = 300; player = game.add.sprite(32, 320, 'dude'); game.physics.enable(player, Phaser.Physics.ARCADE); player.body.collideWorldBounds = true; player.body.gravity.y = 1000; player.body.maxVelocity.y = 500; player.body.setSize(20, 32, 5, 16); StuffBySpencer and Saffii 2 Link to comment Share on other sites More sharing options...
StuffBySpencer Posted April 26, 2014 Author Share Posted April 26, 2014 Thank you sooo much. That is exactly what I was looking for, as long as it doesn't glitch again, it's perfect! Thanks for the helpful reply, really comes in handy during LudumDare lol Link to comment Share on other sites More sharing options...
ema9 Posted April 27, 2014 Share Posted April 27, 2014 Whats the solution to first problem (mapeditor and phaser), anyone help me? sorry for my english Link to comment Share on other sites More sharing options...
StuffBySpencer Posted April 27, 2014 Author Share Posted April 27, 2014 The first problem is what happens when you don't add the correct parameters into the map.addTilesetImage(). The first should be the name of the tileset you named in your script, the second should be the name of the tileset that your map editor named it. To find this out, open your json map file, and look at the tileset-name. Link to comment Share on other sites More sharing options...
ema9 Posted April 27, 2014 Share Posted April 27, 2014 Hi spancer i have this: "tilesets":[ { "firstgid":1, "image":"tmw_desert_spacing.png", "imageheight":1000, "imagewidth":1000, "margin":0, "name":"terrain", "properties": { }, "spacing":0, "tileheight":32, "tilewidth":32 }], in the scripts: tileset = map.addTilesetImage('tiles','terrain'); and the error: Phaser.Cache.getImage: Invalid key: "terrain" phaser.min.js:13Uncaught TypeError: Cannot read property 'height' of undefined Link to comment Share on other sites More sharing options...
Cless Posted April 27, 2014 Share Posted April 27, 2014 @ema9: You probably need to flip the arguments: map.addTilesetImage('terrain', 'tiles'); The first argument is the name of the tileset in Tiled. The second argument is the cache key of the tileset image in Phaser. (Thus, you need to preload the tileset image with the key 'tiles'.) Link to comment Share on other sites More sharing options...
StuffBySpencer Posted April 28, 2014 Author Share Posted April 28, 2014 I'm sorry I think I messed up, the FIRST parameter should be the name tiled uses. So try -> tileset = map.addTilesetImage('terrain','tiles'); Let me know if that helps Link to comment Share on other sites More sharing options...
rich Posted April 28, 2014 Share Posted April 28, 2014 My post + screen shots here should help a bit: http://www.html5gamedevs.com/topic/5668-tiled-json-possible-bug/#entry34406 Link to comment Share on other sites More sharing options...
ema9 Posted April 28, 2014 Share Posted April 28, 2014 thank you very much guysss , now work teach me english hahah Link to comment Share on other sites More sharing options...
Recommended Posts