bump.lua icon indicating copy to clipboard operation
bump.lua copied to clipboard

Be embedded in some block

Open stzengh opened this issue 9 years ago • 2 comments

Hi kikito

Thanks for you BUMP module. I use it in my 2D game.

I found if I set hero high speed and hit some block the hero will be embedded into edge of block. And the hero will lose control.

Move code: local x, y, cols, lens = self.battle.collisionEngine:Move(self, fX, fY , _filter_collision) if lens > 0 then self:OnCollision(x, y, cols, lens) end

Collision filter code: function Player:OnCollisionFilter(item, other) if other.data.base.type == enum_type.Block then return enum_collision.slide elseif other.data.base.type == enum_type.Player then return enum_collision.slide end return nil end

How to solve it?

stzengh avatar Mar 14 '17 07:03 stzengh

Do you have your code on GitHub? It's hard to tell what you mean by 'lose control'. After the collision is detected with the block are you stopping movement? for example if you have a velocity variable, is it set to zero since the player just ran into a wall?

MIfeanyi avatar Mar 14 '17 15:03 MIfeanyi

Thanks Mlfeanyi. I fixed it. It is my bug. :-)

stzengh avatar Mar 14 '17 16:03 stzengh