Jump to content


  • Content Count

  • Joined

  • Last visited

About hustlerinc

  • Rank
    Advanced Member
  1. With the code I attached? Still does it for me in incognito aswell.
  2. If you intend to use the same code for all devices you really have to go much smaller than what you currently have. If the performance is bad on a laptop imagine what it will be on a low-end smartphone. Start small and optimize for the worst performing device (in your case low-end smartphones) and scale up, but the exact dimensions you choose depends on the game and how demanding the rendering is (e.g. how many objects are drawn? are there several layers? etc...). The only way to know really is to test it and see, but you should always aim for the smallest size possible. While the difference
  3. Unfortunately there is no magic number that will work for all scenarios. Decide on a decent aspect ratio (1.5:1 seems common) then make your game and assets as small as you can get away with and scale up as needed (instead of the other way around). What size you go with in the end depends on what type of devices you are targeting and how much cross device compatibility you need.
  4. Sure, heres a .rar with all the files I use: https://www.dropbox.com/s/s78blrk8yj641y2/top-down.rar?dl=0 It's not much, just 100 lines of code so whatever I've done wrong should be easy to find.
  5. Unfortunately it didn't work. I played with the cameraLerp value from 1 to 0.005 but even if it got a little better that low it wasn't really playable and either way sooner or later the camera has to adjust to the sprite speed and the chopping intensifies. I did notice that it gets better if I double the velocity (with and without camera.follow() ), but it's still noticeable and I don't want the sprite to move that fast. If I can't find a solution the easiest fix might be to just change the physics system. Would Ninja physics decrease the performance on mobile devices alot for simple physics
  6. In the example you're using per pixel movement (which doesn't have this problem), so it's hard to say if that will solve the issue. Could you maybe paste the relevant parts of the code here and I'll try it with my code (I tried adding physics and velocity to the fiddle but I don't know how to do it the way you set it up)?
  7. 2.1.4 dev branch (Tilemaps are broken in 2.1.3 so I can't use it). But the issue is there in 2.0.7 too (don't have any older versions lying around) when I test it. I don't think it has anything to do with the dev branch.
  8. I'm doing a 2D top-down game with arcade physics and I've run into a problem. When the camera is following a sprite moving with body.velocity the sprite starts jerking back and forth as if it's vibrating. This doesn't happen if the camera isn't following the sprite. Also if I change sprite.body.velocity.x = 48;into sprite.x += 1; the movement is smooth even when the camera is following the sprite. I've found a few results on Google where people seem to have the same issue, but no solution. Does anyone know how to fix this?
  9. Okay, I figured it out. The problem was in the playerMove() funcion, changing the movement from exact pixels to player.body.velocity.y -= 50;solved it. Seems like a no-brainer now that I think of it.
  10. Hi, thanks for helping me. I'm resizing the map, just didn't want to confuse with too much code in the post. Anyway I added game.physics.startSystem(Phaser.Physics.ARCADE);to my create function right before the call to map.setCollisionBetween(); and I added player.body.setSize(16, 16);after the line enabling arcade physics on the player (also in the create function). Same issue though, I can walk through the tiles I'm supposed to collide with. If it helps here are the tutorials I've read, and I've done pretty much what they do only different ways of setting up the preload, create and update
  11. I'm having trouble with collisions between the player sprite and a tilemap layer created with Tiled Map Editor. The layer is drawn on the screen, and if I turn on debug I see the hitboxes highlighted but there's no collisions. Here's the relevant code: var game = new Phaser.Game(480, 320, Phaser.AUTO, '', { preload: preload, create: create, update: update });function preload() { game.load.spritesheet('player', 'assets/characters.png', 16, 16); game.load.image('tiles', 'assets/tiles.png'); game.load.tilemap('map', 'assets/map.json', null, Phaser.Tilemap.TILED_JSON);}function create() { map =
  12. Yeah, that's the issue I'm having. Apparently nothing to do with the camera but instead the tiles not updating. The dev branch (2.1.4) is working if anyone else runs into the same issue and it can be downloaded here: https://github.com/photonstorm/phaser/tree/dev.
  13. I just updated from 2.0.7, and I noticed my game breaking. For some reason the camera doesn't move, even though it worked fine with the older version. If I start in any corner of the world I can move my character around the screen until it reaches the camera center, where it gets stuck in all directions. And sometimes i can move again (seems random so far) but only between the camera center, and world bounds. The camera never moves. I'm using this line of code (game is my main Phaser.Game object): game.camera.follow(player);Am I using outdated code or is this a bug?
  14. You could turn the contents of a div into a png image then load it as you would any sprite. There are frameworks that do this for you, but I haven't used any myself. Here's one: http://html2canvas.hertzen.com/ and here you can see it in action: http://jsfiddle.net/Sq7hg/2/ Based on the question in the topic this is what you want, but I would only do this if you actually need to use it as an actual sprite in your game. If it's just UI elements I would stick with a div.
  15. Just what I was looking for. That's the second time you solve my problem in 24 hours. Thank you.
  • Create New...