How to treat an ofImage as an ofRectangle to use intersects() method


I am making this maze game where my players and enemies are ofImages. I was told that instead of making my own collision method, I could use the intersects() method that ofRectangles have (since ofImages are technically ofRectangles)s. However, I have had no luck in figuring out how to do this, does anyone know?


Hi, and welcome to the forum!

ofImage is a very useful class that combines file handling, ofPixels and ofTexture. But it does not contain ofRectangle.

Therefore, you have to create a ofRectangle for each and keep track of it. Maybe create a parent class from where your players and enemies can inherit.

that worked! thank you so much!!