Collision with wall on simple pacman game using flash -


i can stop pacman going through wall 1 way can go through wall when going in other direction, code have used is:

onclipevent (enterframe) { if (_root.char.hittest(this)) {     _root.char._x -= 7; } 

}

i need him not go through wall when travelling in either direction! in advance

you facing bug this, because, when modifying heroe's "x" property, decrease it. so, in 1 direction, when move left right , increasing object's "x" value, code works fine. when you're moving in opposite direction, decrease "x" value , on collison object little speeded (by 7 pixels).

to avoid bug have decrease object's "x" when increasing during moving, in other situations, must increase it.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -