1 decade ago by LaserBeam
Hi,
If the player walks towards an entity and collides he has to stop. I achieved this with:
Any idea how to make him not continuing walking after pressing the button, so he only continues walking again after I press one of the direction keys?
Another thing that is strange, maybe someone has seen something like this before: The collision with the first entity can be like described above resolved by pressing the button 'V'. However for all the other entities that follow this button has to be pressed twice, but there are no additional loops, etc in the code. Also the result is always the same not depending which entity is colliding with the player first. Any idea someone?
If the player walks towards an entity and collides he has to stop. I achieved this with:
this.maxVel.x = 0
. For whatever reason trying to set the vel to 0 doesn't work. Further I unbind keys, except one 'V' (which is not one of the direction buttons). Pressing this one I reset the previous value of maxVel. Even though I am not pressing any button the player continues to walk into the direction he walked before he was stopped. The only way to make him stop is to press the button for the direction he is walking.Any idea how to make him not continuing walking after pressing the button, so he only continues walking again after I press one of the direction keys?
Another thing that is strange, maybe someone has seen something like this before: The collision with the first entity can be like described above resolved by pressing the button 'V'. However for all the other entities that follow this button has to be pressed twice, but there are no additional loops, etc in the code. Also the result is always the same not depending which entity is colliding with the player first. Any idea someone?