Question about OOP and interacting objects

I been struggling with OOP for some time now, I always seem to be doing it wrong.

Anyways, my friend challenged me and said "How about you try make flappy bird in a console app?" so that sounded pretty damn cool and I took the challenge.

Just wondering whether I am doing this right. I have a render class, and by that I mean a class that basically prints a 20y 15x 2D array onto the screen. I also have a bird class.

I got the background moving left as it should. (Bunch of random small ascaii characters such as , . ' * " ^ just move across the screen, it looks pretty cool :P) but I just wondering about how I can get the bird to print.

So I thought of the most obvious thing I could think of, just pass my bird X and Y (bird.y and bird.x) postions through my background.Update() method and then make the x and y positions of my array equal to "@" to represent the bird.

background.update(bird.y, bird.x); 

That would mean the bird is now interacting with my background/ render class. Or is it?

Is this the correct way to be doing things and making objects interact with each other? (sort of through a middleman class, which in this case is the one with

public static void main() { //create objects for bird and background and other stuff. // a loop to run while it is still running } 


by Mat2012H via /r/csharp

Leave a Reply