Jump to content

hasTIle always true? + sprite vs tilemap layer


Elgan
 Share

Recommended Posts

First off, love this framework!


would there be much difference in performance after load, with using a sprite as the background layer of a map agaisnt letting the tilemap render the background from a sprite.

 

second;

I have 3 latyers./

 

1 background

2 boulders

3 boxes

 

 

the boxes and boulders are bodies, hard tiles. Boxes can be destroyed with weapons. He walks round and collides with the tiles using .collide(),  However, if he is stood with a wall on his left, and he presses left , the wall is blocked, he should play a different animation

 

Little move tests show that hasTile is ALWAYS TRUE,  even though i check the numbers and there is no tile there?

                var ghardTile = false;                ghardTile = this.game.level.map.hasTile(pointGoing.x, pointGoing.y, this.game.level.boulderLayer);                var gsoftTile = false;                gsoftTile = this.game.level.map.hasTile(pointGoing.x, pointGoing.y, this.game.level.boxLayer);                if (gsoftTile || ghardTile) {                    blocked = true;                    direction = DirectionType.NONE;                }

I want to detect if the tile next to me is blocked, 


i checked tile units using

var tile = this.game.level.map.getTileWorldXY(x, y, 16, 16, this.game.level.backgroundLayer);                var p = tile.x + " " + tile.y;
 
2,2 is where i am, if i put 2,2 into hasTile, for the other layers, its still true, even tho i am stood with no blocked tiles?

Any ideas?
 
 
 
3. (sorry)
Also, why do some examples use
 
this.game.physics.arcade.collide(this, game.level.boxblockLayer)
 
and some do not? without it, my main doesn't collide, it works beautiful with it, but i dont get why some examples like the spaceship one, don't need it. Is it because they both use p2 physics and not a mix of arcade and p2?
 
 
Link to comment
Share on other sites

thank you very much, great to know. will be useful in the future.

right now I need hostile to work or another solution, I need to check if he's blocked before he tries to move and the booleans above only fire if velocity is applied.

also a note. body seems to be missing intellisence? can someone check before I report it?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...