1
General / Drawing Too Many Sprites Slows Down Game
« on: January 20, 2021, 01:13:56 am »
Hi all, I'm relatively new to SFML and decided to make a simple game where you control a platform and you capture falling fruits. To draw the fruits, I simply store the Fruit pointers in a Vector2f and draw the sprites associated with each pointer. Furthermore, I move each sprite a few pixels every loop so that it may "fall" down the screen. unfortunately, I noticed that the more sprites I draw, i.e. the larger the vector, the slower my game gets. It lags terrible when I double the amount of fruits and moving the platform is unbearably slow, even though normally it would move fine. I will include the relative parts of the code here. Any help would be greatly appreciated. This is my first game meant to be a test, and see what I could possibly do in the future.