Thanks for all the help, and I apologise for this late reply. The game is not based on a grid, it is a free roaming game. I think I now see how I can make this work, so no problem there.
I'll use a method for moving right and design it so that if moving right caused the player to collide with the tree, it will simply move him back before refreshing the screen, and therefore he will not pass through the tree.
I'll try to code it later today.
I'll use a method for moving right and design it so that if moving right caused the player to collide with the tree, it will simply move him back before refreshing the screen, and therefore he will not pass through the tree.
I'll try to code it later today.