Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blade Traps are implemented incorrectly #42

Open
SirGouki opened this issue Jan 12, 2024 · 0 comments
Open

Blade Traps are implemented incorrectly #42

SirGouki opened this issue Jan 12, 2024 · 0 comments

Comments

@SirGouki
Copy link

I was messing around with the in game editor, trying to fix the incorrect block in the tail dungeon (there's a block in front of a blade trap you're supposed to be able to push upwards to block it, but in the map its a tile with a collision box instead). I finally figured out how to change the block, saved the map and pushed the block up to block the blade trap. When I went to cross its path, the blade trap traveled through the block and hit me anyway. Pulling up the source, I noticed that, unlike most entities, this one does not have anything assigning it a collision box that tells it it can't go through walls. It is instead coded to use some math to know where its beginning and final points are in all directions and will ignore anything placed in between them.

_maxPosition[0] = left * 16;
_maxPosition[1] = right * 16;
_maxPosition[2] = top * 16;
_maxPosition[3] = bottom * 16;
_collisionRectangles[0] = new RectangleF(posX - left * 16 - 16, posY - padding, left * 16 + 16, height);
_collisionRectangles[1] = new RectangleF(posX + 16, posY - padding, right * 16 + 16, height);
_collisionRectangles[2] = new RectangleF(posX - padding, posY - top * 16 - 16, width, top * 16 + 16);
_collisionRectangles[3] = new RectangleF(posX - padding, posY + 16, width, bottom * 16 + 16);

for comparison:

Body = new BodyComponent(EntityPosition, -7, -10, 14, 10, 8)
{
MoveCollision = OnCollision,
CollisionTypes = Values.CollisionTypes.Normal |
Values.CollisionTypes.Enemy,
AvoidTypes = Values.CollisionTypes.Hole |
Values.CollisionTypes.NPCWall,
FieldRectangle = _fieldRectangle,
Bounciness = 0.25f,
AbsorbPercentage = 0.9f,
Drag = 0.85f
};

There are no checks anywhere in the blade trap's code for any potential obstacles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant