This forum is read only and just serves as an archive. If you
have any questions, please post them on github.com/phoboslab/impact
Hi,
The player gets a blowback when colliding with an enemy. I used
other.pos.x = oldPosX - blowback
and changed it then to
other.vel.x = blowback
However if the player is close to a wall, he still goes through the wall and then stops inside of it. Any idea why the wall in this case lets the player through and otherwise not?
1 decade ago
by Arantor
What are the types of entity involved (types NONE, A or B) and what are their collides properties set to (FIXED, ACTIVE, PASSIVE etc)
Player: Type A, Collides Passive.
Enemy: Type B, Collides Passive.
1 decade ago
by Arantor
I think you'll find it's because they're both set to PASSIVE, the wall generally should be set to FIXED.
(Weak entities always move in the case of collision)
Though, under most circumstances you'd make maps and rooms with the level editor, which would end up using a static collision map anyway... just curious, what are you doing that doesn't do that?
(FWIW, I've been working on a shoot-em-up where the ground is represented by an entity, not because it moves but because it solves certain other problems because I'm working on a 1920x200 scrollable area that seamlessly wraps around, and using a collision map just wasn't working for me the way doing it as an entity does)
The player's and enemie's parameters are as above stated. The level was designed with Weltmeister. It works fine if the player or an enemy runs towards the wall, they get stopped by the wall as they should.
It made sense that the player or enemy gets inside the wall when I used other.pos.x (if player and enemy collided) however it does not make sense to me if I am using other.vel.x as the player or enemy is pushed with this velocity into one of the directions, and if there is a wall this should stop the player or enemy as it does otherwise as well. Maybe it's a bug, dunno.
P.S.: Looking forward to see your game, sounds interesting with the scrollable area.
1 decade ago
by Arantor
I'm just curious... why create a wall as an entity when Weltmeister offers collision layers that will be resolved automatically for you?
Part of this comes down to how collisions are detected; entity vs collision layers are treated differently to entity vs entity, and entity vs entity is implicitly designed to overlap while entity vs collision layer generally isn't.
PASSIVE vs PASSIVE means you are going to get overlap where the velocity of one entity causes it to overlap and the collision won't necessarily be handled properly as a result.
I think we are talking at cross-purposes. Only the player as well as the enemy are created as entites, the walls are created with the collision layers that come with Weltmeister. That's why I am confused why it doesn't work as it should.
By now I just tried for the player all the available collision modes but it does not matter which one I am using, the player always ends up inside the wall.
1 decade ago
by Arantor
Oh, that would explain why I'm so confused.
Is the blowback evaluated before or after the entity calls this.parent()? If the entity's movement is evaluated after this.parent() is called, it'll be evaluated after the entity collision stage.
Where is the blowback occurring? You'll want to do a ig.game.collisionMap.trace() after the blowback to test for map collisions and resolve them.
It works now, the player gets stopped by the wall. I ended up with the following code:
other.vel.x -= blowback;
Thanks guys for the suggestions.
Page 1 of 1
« first
« previous
next ›
last »