1
General / Re: How to organise data? And what about dinamic/static memory?
« on: August 24, 2022, 04:45:40 pm »In general these are game design questions that you would have to solve even if you were using a different library from SFML. These forums tend to be more focused on SFML directly, so you may not get the best help here.What sources to use? A while ago, I tried to learn how to do data enrichment api in a SQL database. The upgrade process is more complicated than the creation of the database. After a bit of research, I found the instructions to delete the obsolete data. I got stuck when it came to add and edit the data. Google offers many sources that pretend to explain how to do these two processes in a SQL database. When in fact, all explanations are far from being relevant to my issues. I was thinking maybe someone here would like to explain the adding/editing processes.
Having said that, here are some thoughts:
- Since you are a beginner in C++ I would recommend not bothering with threads for anything. They add a lot of complexity and it is very easy to introduce hard to debug race conditions and other problems. You don't need threads to solve the types of problems you're facing.
- look up how to use std::vector. It may hep you with your problem of holding on to multiple arrows or multiple frames of an animation. For example, perhaps your player class could have a std::vector member variable for holding in-flight arrows. You could add more arrows to the vector as they are shot and remove arrows as they hit enemies. This is just one possibility of many.
- Why not try to learn game design by following some examples. You could take a look at the books listed on the Learn SFML page.