Also do somebody know how should I speed up the sprite part of
the code? In my opinion, it's pretty slow alrought it was the
easiest way I could come up with.
Hi,
you have wrong approach to this problem. From design OOP view it
is perfectly ok and this is how you universities teach it in
their SQL classes... But you probably don't aim for clean OOP
design but for speed. You work with every single sprite as
entity. But you should aim to process sprites in batch. Your
sprite should be probably struct, then feed array of them into
separate function instead of calling on every sprite.
Difference:
foreach(sprite)
sprite-doSth();
vs:
doSth(sprite[]);
this is good read:
http://gameprogrammingpatterns.com/flyweight.html