i'm working on a project in c++ which is the pikachu classic game, i just got basic understanding about linked list and pointers and dont even know where to start. I did research for a couple of days but they're so hard to understand and i still got no idea how it works. can anyone give me an outline of what to do? thank you so much.
#pikachu classic game
20 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
Pointers and linked lists are not really relevant because the standard library has that covered.
The classic answer to this problem is what I'd call OOP modeling. You decide that you want a character to move around, so you make ```cpp
class Character {
};
Then you decide what those should be able to do. Maybe
`void walk(Direction direction);` and update the code accordingly:
```cpp
class Character {
void walk(Direction direction);
};
We didn't define what a direction is, but that's what
class Direction {
};
is for.
Sometimes you notice that a class is the wrong tool, a Direction could be an enum and sometimes you want a function instead of a class.
Anyway, over time you just add the capabilities to your classes and your program grows to express what you had in mind. You'll probably not get everything right, but when it comes to implementing a function you'll notice that it's impossible because you don't have [thing], so you can add that to make it work.
The first times you're likely to make mistakes, like overusing classes, getting stuck in details or ending up with an incomprehensible mess, but you'll learn from it and do better next time.
You should also decide what to concentrate on. If you care about data structures you can implement and use yours, otherwise std::vector has you covered. If you want to make movement and directions and such you can do that, otherwise RPGMaker or a library that does similar things have you covered.
Try to avoid implementing things you don't care about. You probably just want to draw some images on the screen. No need to go through the pain of learning how to draw a tringle in OpenGL for that.
please update progress here
no no my project is pikachu classic like the matching puzzle game where the path between 2 matching cells doesnt bend more than 2 times like L path, Z path, U, and I path
And i guess i can replace the pokemons by letters
I don't know that game, but you mentioned various things from the game that are important to it. Time to describe what they do via classes.
Or functions/enums/whatever
Is it possible to code this game without oop
Sure
Go functional. Everything is a constant. Need to express something that changes over time? Monads to the rescue. Go wild.
Would not recommend though. Having each thing be a class with member functions describing what the things can do is pretty easy to understand.
DOD is another approach. Just understand the input data (key presses probably) and the output data (instructions for your graphics engine) and find the fastest algorithm that transforms the input data to the output data.
Also would not recommend. Understanding the data is difficult, figuring out the algorithms is a pain and if you got a detail wrong you gotta start over.
Or use an ECS, that's what's popular with games. You make everything an entity and attach components to them that describe what the entities do and then have systems run over the components that apply the logic. It'll have a bit more of a learning curve and messing with an ECS library, but otherwise it's fairly straightforward.