0
What does this code means? i mean why y++ coordinate going down if the value of y is increasing vice-versa!
{ head.direction=key; if(key==UP) head.y--; if(key==DOWN) head.y++; }
1 Odpowiedź
+ 4
Coordinates starts from upper left corner, the upper left coordinate are (0,0), this way to move up we subtract y, to move down increase y, to move left decrease x, and to move right increase x.
Hth, cmiiw