Forklaring til Object wall Detection!
Hejza!Har lige købt en ny bog, der er noget tekst som ser sådan ud:
if the x position of the object minus one-half its width is less then the x position of the LEFT wall, the object is colliding with the LEFT wall.
if the x position of the object plus one-half its width is grater then the x position of the RIGHT wall, the object is colliding with the RIGHT wall.
if the y position of the object minus one-half its HEIGHT is less then the y position of the TOP wall, the object is colliding with the TOP wall.
if the y position of the object plus one-half its HEIGHT is greater then the y position of the BOTTOM wall, the object is colliding with the BOTTOM wall.
left bound = x-width/2
right bound = x+width/2
top bound = y-height/2
bottom bound = y+height/2
Jeg forstår det egentlig godt men det jeg ikke kan forstå er at man skal minus one-half its width, men kun på Venstre og Top.
Håber at der er nogen der forstår..
TeleMuzen