Any ideas how i could have less function arguments (something like global variables or idk?)
https://github.com/Mikicrepstudios/Random-SDL-Game
check for example player.h and main.cpp
#Simplifying functions
8 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.
you could use classes/objects. If you have a player class, you could store the player's parameters (like current position and speed) as members of the class. You could also give it a reference to the world map, only once, and it will keep it as a class member. The movement function would then be a class method, and you don't have to send any parameters other than the direction (event).
Look up the basics of object oriented programming (not the complicated stuff, just the basics, how classes and members work)
do u know some sites where i can read abt classes
i don't know any specific sites, but any c++ tutorial should cover them
How to Learn C++ Programming
We generally recommend a good book to learn the necessary fundamentals:
To actually write and run C++ code, you will need a compiler, editor, and debugger. We strongly recommend to start out using an IDE, which will provide all these tools for you:
<:microsoft:1165512917047853127> Windows
- [Visual Studio](#1165492293810257920 message)
- CLion
<:tux:1165505626894520361> Linux
Words of Advice
The wise programmer is told about the debugger and uses it.
The average programmer is told about the debugger and avoids it.
The foolish programmer is told about the debugger and laughs at it.