Problem with OOP implementation of interface class

You have a good challenge there. I cannot provide a straight answer as I will need to do a couple of iterations in my head to provide a good proposal. However, using an interface here in your game seems to be a good approach. The interface could contain the x,y position of your “Movable” object. I am not 100% sure, but you can have another interface that describes the dimensions of the object, say interface “Body”. For example, a monster, your ship, the island all has dimensions (width and height if they are represented by squares, for example)

Now, monster, your ship and islands will implement these two interfaces. Movable can define an internal function that accepts an object that implements “Body”. This works well because an object that implements Body means that it has a width and a height, so you can tap in into the object and do the boundary checking. This should work.

Maybe you want to explore this next post where I did a demo of static and dynamic squares. It does not use interfaces but you can see an OOP implementation, although I am sure you can find many other good examples here in the forum: How to use mouseClicked to only effect one object in ArrayList?

Finally, I will suggest to make your Monster an abstract class. The reason is that your game will not implement a monster ever but you will always have either a crab or an octopus. Sorry I cant provide code today but I hope this gives you some push in the right direction.

Give it a try and share your questions if something here is not clear.

Kf