asmcup / runtime

Runtime and compiler for the Assembly Cup
https://asmcup.github.io
MIT License
139 stars 11 forks source link

Rewrote most tile checking logic. #200

Closed MLanghof closed 7 years ago

MLanghof commented 7 years ago

First of all, removed the tile logic (isSolid() etc.) from Cell. Either doubling all the functions into World or forcing other classes to go through (or even know about) Cell is awful.

Tile values can now be checked through a set of functions that is both easily extensible and encompassing, while also being brief and intuitive to use.

Overall, this change should help encapsulation a lot. For example, it was trivial to make the laser end when it exits the world, which was previously infuriatingly difficult.

MLanghof commented 7 years ago

By the way, if the TILE class name is not acceptable, let me know. I feel like it fits right in when used though (and naming it Tile would leave unfamiliar people very confused as to why tiles are not instances of Tile).