Hello GameDev team,
I would like to ask why this code is not working properly, what is difference from the code in video:
if (CheckCollisionRecs(prop.GetCollisionRec(knigth.getWorldPos()), knigth.GetCollisionRec()))
{
collision = true;
}
if(collision)
{
knigth.undoMovement();
}
Tha character simply stop moving or better say “world” is not moving when collision (set to false outside while loop) is true but animation is working.
Could you shortly explain why is that? Is it not the same code just with 1 additional variable and if statement? I know that it’s not cleaner code as in video but I am curious why it’s not working.
Thanks a lot.
Lukas