Jump to content

Some of tiles not colliding after State change ... (Framework Issue ? :/)


Full2D
 Share

Recommended Posts

Hi all,

Im having Verry irrytating problem with Collisions in Phaser.

Im building simple tile based game.Using Tiled.

Every level is in separate game state.

 

Every thing is working just fine in level 01,

But when im crosing into secret Level  (changing state),

only some of tiles are colliding. (before there was all of them working just fine)...

its really strange...

 

Here is code with settings for this:

(in create method):

 

    this.layer2 = this.map.createLayer('blocks');

 

    this.map.setCollisionBetween(25, 49,true,  this.layer2);
    this.map.setCollisionBetween(55, 72,true,  this.layer2);
    this.map.setCollisionBetween(89, 108,true,  this.layer2);
    this.map.setCollisionBetween(123, 126,true, this.layer2);
    this.map.setCollisionBetween(127, 134,true,  this.layer2);
    this.map.setCollisionBetween(141, 144,true, this.layer2);
    this.map.setCollisionBetween(157, 161,true, this.layer2);
    this.map.setCollisionBetween(175, 179,true, this.layer2);
 

(than in update):

 this.physics.arcade.collide(this.sprite, this.layer2);

 

every thing seems to be okay, but after this change of state it is not ...

 

only this works:

  this.map.setCollisionBetween(123, 126,true, this.layer2);

 

and some other random tiles...

 

Any ideas ? mybe someone had similair problem?

 

One more thing:

when trying this solution:

 this.map.setCollision([9,10,11,12,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,55,56,57,58,59,60,61, and s on...

some strange phaser.min error occures in console, and game does not work at all.

Maybe its Framework issue ?

 

(the problem with collisions does not occure when using renamed Level1 state instead of secret one)...

(strange as well - there is no logic into this, but maybe im not knowing all).

 

Thanks for ANY help :)

 

Link to comment
Share on other sites

There is definetly something wrong with framework...

I'v solved this by making setCollisionsBetween(1,1000,true,layerC),(so just one assigment instead of like 8 before).

(so You cant make to many set collisions between becouse framework goes nuts - You must be creative ;]).

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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