So yeah, I’m new to programming in general. But I need help organizing the structure of a game I’m trying to program for practice…
I got my graphics environment working (at least I think!)
I just need to know how to set up my classes…Or just how I should do this in general.
My game. Ever play the game, Intelligent Qube for PS1? Well I really loved it, and it seems simple enough to do. I will be doing a 2d top-down version. Here’s a basic overview for those of you who haven’t played it.
On second thought here’s a link to a video of the game to make it easier to understand.
link to video
Well it’s a really cool game, and I’d like to try to figure out how to make a clone so I can learn some things about it.
So I was trying to think of the way to structure the program, and I had a few ideas. One is pretty bad, and I would like to avoid it.
I could always go for one single 2d array that holds all of the data with various functions that would advance the blocks and destroy them depending on what the player does. This would be very boring and tedious I believe. I just did a test of this without graphics (text only) and it was cumbersome to ensure that the movement and everything worked right.
For example, to advance the blocks, I had to write two loops to check every block, and move the contents up to the next one. I need to learn how to use classes better, and would like to be able to involve them.
The best thing I can think of doing would be to create a “block” class and to use every variable possible inside.
Perhaps I can use the board as a way to communicate between the block and the player? That makes the most sense to me, but it seems clumsy. Would I need to have every cell of the board have a different state? THe possible ones are “Normal Block” “Death Block” “Green Block” “Blue Bomb” “Green Bomb” “Player 1” and any combination thereof. It seems tedious.
I’ve been having this problem. I know how to use classes but I don’t know how to use them in any way that makes my life easier. I keep running into situations where I want a nested class to work on things that are in it’s parent class. I could get around this by writing the functions in the main area of the class, but then why not just write the functions in the main function then?
Anyone want to enlighten me as to what I’m missing here?
ETA:
I suppose I could sum up my problem by saying, how do you work with various objects and the board? Let’s say if I were making a Super Mario clone. I want Mario to interact with a Goomba. How do I do that? Do I have all of the information as to where they both are stored in the board? Surely there is some way for the Mario object to send a message to the Goomba object telling the goomba that it is dead when he jumps on it, right?