Hypotakt
Member
Hey guys,
I am obviously searching for a smooth collision handling system for my game. I spent a lot of time today, finding a good way to implement, but had no success yet.
The game character is moving per direction and speed, but it has only 4 different directions in sprite (left, right, up and down). I am doing the direction thing with a gamepad, so 360° is possible to move. I have objects, like trees, which the player can't access. So moving in the direction should not be possible. Every Sprite has a mask (Bounding Box) which I setted already.
All my tries leaded to bad results, like the player get's pushed away from the tree mask but since my view is following the player the screen was shaking hardcore (player can move again, every time it's pushed away). An other bad result was that the movement stopped when I the player was on 1px distance to the hitbox tree, but the movement was completly stucked.
I tried it many ways, but everything leads to a lot of redudant code (slow build at the end) or a lot of bugs. You guys can help out with some neat solution? I'm sick of can't solve this problem ^^
PS: If it's not clear - I search especially for a system which works for the whole mask. The X,Y of each sprite is centered, but if I use something like place_free() it checks just for the center of the sprite and the mask has access to the tree.
- cheers
I am obviously searching for a smooth collision handling system for my game. I spent a lot of time today, finding a good way to implement, but had no success yet.
The game character is moving per direction and speed, but it has only 4 different directions in sprite (left, right, up and down). I am doing the direction thing with a gamepad, so 360° is possible to move. I have objects, like trees, which the player can't access. So moving in the direction should not be possible. Every Sprite has a mask (Bounding Box) which I setted already.
All my tries leaded to bad results, like the player get's pushed away from the tree mask but since my view is following the player the screen was shaking hardcore (player can move again, every time it's pushed away). An other bad result was that the movement stopped when I the player was on 1px distance to the hitbox tree, but the movement was completly stucked.
I tried it many ways, but everything leads to a lot of redudant code (slow build at the end) or a lot of bugs. You guys can help out with some neat solution? I'm sick of can't solve this problem ^^
PS: If it's not clear - I search especially for a system which works for the whole mask. The X,Y of each sprite is centered, but if I use something like place_free() it checks just for the center of the sprite and the mask has access to the tree.
- cheers
Last edited: