scarfyPos.x = windowwidth/2 - scarfyRec.width/2; centres the image to the middle of the screen… why? Is this just maths? How could I know that halving the width of scarfyRec would move the x in just so such a way that places the rest of the image in the centre. Seems to me that the x wouldn’t move at all and i’ve just cut the image width in half. Making a shape smaller doesn’t mean every corner (especially in this case the top left corner) moves… obviously it does in this… but why?
I don’t want just an answer, I want to know why the answer is that way (No point telling me the destination without the way to get to it).
Also: Why isn’t this ground check a double dip?
If I have already declared that scarfyPos.y = windowheight - scarfyRec.height; then when ground checking if (scarfyPos.y >= windowheight - scarfyRec.height) hasn’t scarfyPos.y already once before had its windowheight reduced by scarfyRec.height. Why is this not causing something unintended.