etzl / among-stars

Simple game in terminal
GNU General Public License v3.0
0 stars 0 forks source link

player collision #20

Closed abel-mak closed 2 years ago

abel-mak commented 2 years ago

player gets outside the window when moving horizontally

etzl commented 2 years ago

A quick solution can be maxx to get the maximum possible value of the current window and check the player's x to be within range 0 and maxx.

But a more elegant solution is designing a base class (#4) to apply this to all objects. I'm still not sure how to implement such a base class, as I've had tried before without success

etzl commented 2 years ago

fixed https://github.com/etzl/among-stars/commit/bf100e69e485b824ebe41cae5ed18094cf39c20b