So I am working on a console based RPG game where you play as a brave ampersand symbol sent into a dungeon to collect dollar symbols...yeah I know lol but I am having some issues with the second map function that I created.
What the map2 function does is the same as the map1 function which is control the movement of the ampersand symbol and the collection of the dollar symbols.
In function `void map2()`
`void map2()` redeclared as different kind of symbol
16 previous declaration of `char map2[10][15]'
16 previous non-function declaration `char map2[10][15]'
31 conflicts with function declaration `void map2()'
I have no idea how to fix this..
Any help would be greatly appreciated. =D
Without looking at the code, it would seem that you're using a variable inside your method with the same name as the method, hence the redeclaration error(s).
The function map2 is re-declared as a multidimensional array - so the compiler doesn't know which symbol you're trying to work with. 'map2[][]' versus 'void map2(void)'
*Edit - To fix this, try changing either your method's name, or multidimensional array's name.
If you want to start making games, don't use the console.
Actually they can. They just got to design in such a way all console rendering code are kept clean from the algorithm and data structure code.
Then once they learn the GUI SDK, they can just replace the chunk of console rendering code and leave the previous algorithm and data structure code un-touched.
And it can even be the overall program flow. Games tend to be event driven and have time regulated by a steady source (whether it be a clock or a framerate). On the other hand console programs tend to be user-input driven and run as fast as the computer will allow.
It's like using a hammer to turn a screw -- you really can do it if you try hard enough, but it's the wrong tool for the job, and it'd be easier to just use the right tool.
Besides -- expecting a beginner to be able to properly segregate I/O code from the program core is unrealistic. Especially if they're unfamiliar with other libs and what they require. For example, even from the OP's post I can tell he's storing his map as an array of characters ('#' is probably a wall, '.' is a floor, etc). Seems logical for a console approach, but is crazy for a graphical approach.
He's learning how to do things the wrong way. He'll have to come out of this hole sometime, and it's better if he does it now than waiting for him to dig himself deeper into it.
And it can even be the overall program flow. Games tend to be event driven and have time regulated by a steady source (whether it be a clock or a framerate).
Hi Dish you are correct on every point except maybe the above. Granted most RPG are based on some clock or frame-rate but there are also games that are turn-based. Chess, othello, tic-tac-toe etc etc are games that are turn-based. In such design, we don't need any clock or frame-rate. We react based on player decision.
Of cuz turn-based game pale in comparison to full-blown RPG but they are still games neverth-less and based on my previous post, there are about 200 million casual gamers that play simple games and that include games that are turn-based :P
but there are also games that are turn-based. Chess, othello, tic-tac-toe etc etc are games that are turn-based.
Even those are event based if there's any kind of animation.
But anyway that's not my point. My point is he's stepping into a different world. Console dev and game dev are two completely different things. If he wants to work on game dev, then he should work on game dev. For that, he should leave the console.
there are about 200 million casual gamers that play simple games and that include games that are turn-based :P
And they are definitely not playing console games. Not the kind of console we're talking about, anyway. Also, big games like Civilization are turn based too.
Sheesh...I was just trying to refine my knowledge of the c++ language a little more lol. I'm not going to be a console dev but it is fun to make these little games sometimes..and I'm learning a lot from my mistakes while making this.
You learn a lot more when you do what you like to do.
If making games is fun for you, then I really would recommend you get a game lib like SFML and start using it. You'll learn more, faster, and you'll have more fun in the process.