Structure of graphical C++ program?

Hello all.

I'm just wondering if my idea of how this all works is correct:

in a C++ file, you type some code saying "open a window."

in the same file, you type some more code saying "get this picture file out of this folder and display it on said window."

in possibly another file, you type more code saying "make these pictures objects, and here are there properties(define properties)."

let's just say this triangle's HEALTH property is at 100. type code "if this triangle touches this circle, make triangle's HEALTH property lower by 10.

and so on.

Is this in any way correct? I'm asking this to see if I'm even close to correct on how OOP works, and how games are structured, etc.

Please correct me if I'm wrong, but try to be simple because I don't actually know C++ yet, I just want to know what to expect.
I would suggest component based entities so you can reuse code. A triangle (enemy) has health, has a collider, and has a path to follow. A wall has health and a collider. A projectile has movement, collider, and damage.

There are other game design patterns but I would say a class hierarchy is probably the worst approach for the most part.
Topic archived. No new replies allowed.