do you mean the solution here is, i create an empty texture first then i will put there thisNo. Why getSize().x * 2? That is twice the texture's width... What do you want to achieve?
sprite.setTextureRect(sf::IntRect(0, 0, texture.getSize().x* 2 , texture.getSize().y));?
what do you mean? i just think add poll will create a new topic in this forum, im new to this forum im sorry if im doing wrongThe button for that is "New Topic", not "New Poll" ;)
I'd advise making a class for the alien and putting a sprite and texture in it as a simple space invaders game shouldn't be too processor expensive pretty much however you do it.You should not store the texture inside the alien class, because it is needlessly duplicated for every alien. Pass a texture reference to the alien's constructor instead.
You should not store the texture inside the alien class, because it is needlessly duplicated for every alien. Pass a texture reference to the alien's constructor instead.Is there any reason not to take this further and do the following? Pass a sprite reference in the constructor, then use float positions in the class, give the class a draw function that should be called between window.clear() and window.display() and then make each call of the draw function move the refenced sprite (which can be shared between objects) to the correct position and print it on the screen. Thus making many objects that use the same texture only uses one texture and one sprite.