Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Nanolucas

Hello,

I'm attempting to have two overlapping entities:

1 Wall
1 Sliding Door

I have the sliding door partly behind the wall and my goal is to have a trigger to slide the door completely behind the wall to allow the player to pass through. The overlapping is achieved with zIndex.

The issue is that if I have both of these entities fixed, one will move the other one (they are placed with weltmeister) on game load.

They are set up as:

type: ig.Entity.TYPE.B,
checkAgainst: ig.Entity.TYPE.A,
collides: ig.Entity.COLLIDES.FIXED,

and my player is set up as:

collides: ig.Entity.COLLIDES.ACTIVE,
type: ig.Entity.TYPE.A,
checkAgainst: ig.Entity.TYPE.BOTH,

How can I have the entities collide against the player but not each other?

1 decade ago by Joncom

I think you want to set up your player as one type.

And then set up both the wall and sliding door entities as the opposite type.

Then the only entity that should be doing any checkAgainst is your player, against it's opposite type.

Example:
/* player.js */
type: ig.Entity.TYPE.A,
checkAgainst: ig.Entity.TYPE.B,

/* slide-door.js */
type: ig.Entity.TYPE.B,
checkAgainst: ig.Entity.TYPE.NONE,

/* wall.js */
type: ig.Entity.TYPE.B,
checkAgainst: ig.Entity.TYPE.NONE,

1 decade ago by Nanolucas

I've tried exactly that but the issue is that the fixed entities are either interacting with each other or interacting with the collisionMap.

This is how it looks in weltmeister:

/><br />
<br />
<br />
This is how it looks when the game is running:<br />
<br />
<img src=

1 decade ago by Joncom

If your wall-entities are supposed to be able to move to places where the player is not, then you will need to disable collision-map on those entities.

However, instead of doing that, perhaps you might consider taking a different approach altogether. Why not let the map contain all walls, and just have the two entities: player, and sliding door?

You could add an animation to make the door appear to be sliding. type could be ig.Entity.TYPE.B when the door is closed, and ig.Entity.TYPE.NONE when the door is open so the player can pass through.

1 decade ago by Nanolucas

The reason the wall is actually an entity is that I want the door to slide behind the wall, which [from what I've read] is not possible since the map is all one layer. That's why I'm attempting to use entities with different zIndexes.

I'll try disabling the checks for the collision map for those entities and if they still collide correctly with the player then everything will be perfect :)
Page 1 of 1
« first « previous next › last »