Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Selecting different sized Sprites from Sprite Sheet  (Read 1358 times)

0 Members and 1 Guest are viewing this topic.

codelyoko373

  • Newbie
  • *
  • Posts: 8
    • View Profile
Selecting different sized Sprites from Sprite Sheet
« on: August 20, 2017, 02:07:53 am »
I'm quite new to SFML and I have looked at some videos of getting different sprites from sprite sheets but the reason those videos haven't really helped me is they use sprite sheets that hold same sized sprites throughout while the sprite sheet I'm using which is for Space Invaders:

Has different sized sprites.

I was wondering how exactly I would get these different sized sprites out of the sprite sheet?

Hapax

  • Hero Member
  • *****
  • Posts: 3381
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Selecting different sized Sprites from Sprite Sheet
« Reply #1 on: August 20, 2017, 02:38:47 am »
Set the texture rect of the sf::Sprite to match the image part that you wish to use. The sprite automatically resizes to the size of the part of the image that you choose in this way.

sf::Sprite::SetTextureRect
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything