• Content Count

  • Joined

  • Last visited

About microspace

  • Rank
    Advanced Member

Profile Information

  • Gender
  • Location
    Russia, Ufa

Recent Profile Visitors

456 profile views
  1. No, I don't need to calculate position every frame, only once he crosses tile boundary. Maybe you are right
  2. Sorry, I didnt notice that I removed reference tile, thats why error occured
  3. Is there a way to determine sprite position in terms of tiles, faster than in the example: update: function () { var cposx = Math.floor(player.x / TileSize); var cposy = Math.floor(player.y / TileSize); } I dont want to load too much calculations inside update function. Maybe there is asynchronous way to do this or maybe there is built-in function to od this.
  4. I create layer from Tiled with these commands: var map; var fog; var flour; ... map = this.game.add.tilemap('lesson51'); map.addTilesetImage('tileSheetWinter', 'gameTiles'); flour = map.createLayer('flour'); fog = map.createLayer('fog'); flour.resizeWorld(); ... Why `map.getTileAbove(fog, x, y);` gives error TypeError: Cannot read property 'data' of undefined but map.getTile(x, y, fog); return Tile object as expected?
  5. Hello! I want to reload map, but this time without destroying map object. Previously I was doing it this way: Create: map = TopDownGame.game.add.tilemap("mytilemap"); map.addTilesetImage('tileSheet', 'myTiles'); flour = map.createLayer('flour'); Destroy and recreate: map.destroy(); flour.destroy(); map = TopDownGame.game.add.tilemap("mytilemap"); map.addTilesetImage('tileSheet', 'myTiles'); flour = map.createLayer('flour'); But here I have to destroy map object too. Is there a way to do this without destroying map object? (I now that I can always use `putTileWorld`)
  6. After some thinking, I came to conclusion that I need to sort individual tiles to achieve this. I simply want to avoid this: The ice mountain consists of 4 tiles nad it was created in Tiled. So the simplest solution is to recreate all such objects (as mountains) using sprites?
  7. Hello! Is there a way to sort tile layer on the map same as it is done here https://phaser.io/examples/v2/groups/depth-sort I the exxample sorting is done on group elements. I want to achieve same result as in example, but I operate with tile layers.
  8. Thank you, @samme, this was really helpful!
  9. In my game, player moves automatically using tween, than it shoots a bullet also automatically. Camera is set to follow player, so during the tweening world view changes. This causes the bullet to fly from the player too early, as if weapon chases the player during tweening and can't run after it. Here is example video of the bug. On the video we can see that bullet flies over barrel. But it must hit the barrel nad it does hit it sometimes. So the question is, how to skip couple of game ticks before shooting, so that the weapon and the player settle down to one coordinate? Or is there something like "force update screen"?
  10. So I had to put group of immovable and impassable sprites as a barier for upper level. Not a beautiful solution, but will do.
  11. I've got a tilemap created in Tiled and there is a platform with ladder on the map. How to make player stop when it tries to move from platform to group layer? Also how to make player collide with tiles pointed by green arrow when player approaches then from left, bot not collide when player approaches from right. Simply, is there `checkCollision` property for a tile?
  12. You need to place div contained with an id attribute: https://stackoverflow.com/a/21053003/1402321
  13. Hello! Here you go: https://github.com/rusi/canvas-demos Nice project! I'll appreciate if you show us the results 🙂
  14. But still I can't set opacity on tile inside game loop. Only on level creation.
  15. You do something like var frame = 10; player = GAME.add.sprite(0, 0, 'cardsheet', frame); That you can change sprite with player.frame = 15;