Ok so I have this 2D Tile RPG I am making….
here is a live applet:
http://mystikrpg.com/so/
The code is also at http://mystikrpg.com/so/
Anyway, if you examine the code, it seems the I can only block tile 24 (which are the walls)…
Do any of you awesome wise java experts see any way I can have MULTIPLE tiles that are blocked?
I have zipped the required files so that you may play around if you want/can here: http://mystikrpg.com/so/2drpg.zip
I hope I can block more than one tile… 🙂
Thanks
Here’s the code summary of your problem:
It clearly shows that you are only blocking “24”. There are several approaches in which you can do this. Looking at your code, I agree with Jon Skeet that it’s not very object oriented and it is better to use encapsulation and objects to help you in your code and design. But to answer your question, you can just simply put the blocked tiles in a HashSet and check if they contain the tile, then return it as “blockable”. E.g.