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

Author Topic: Transparent part of a sprite  (Read 3364 times)

0 Members and 1 Guest are viewing this topic.

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Transparent part of a sprite
« on: July 27, 2015, 09:24:58 am »
is the transparent part of a sprite is still collidable when i use globalbounds?

I have a sprite and I use gimp to make some part of sprite transparent.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Transparent part of a sprite
« Reply #1 on: July 27, 2015, 09:39:21 am »
Quote
is the transparent part of a sprite is still collidable when i use globalbounds?
No Yes. The global bounds of a sprite (or any other SFML entity) is only computed from its position, scale and size.
« Last Edit: July 27, 2015, 10:00:02 am by Laurent »
Laurent Gomila - SFML developer

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Re: Transparent part of a sprite
« Reply #2 on: July 27, 2015, 09:55:46 am »
@Laurent
Quote
No. The global bounds of a sprite (or any other SFML entity) is only computed from its position, scale and size.
got it thanks, how about localbounds?

SpeCter

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: Transparent part of a sprite
« Reply #3 on: July 27, 2015, 09:57:53 am »
Quote
is the transparent part of a sprite is still collidable when i use globalbounds?
No. The global bounds of a sprite (or any other SFML entity) is only computed from its position, scale and size.


Wouldn't it be collidable for the transparent parts then? A sprite that is transparent due to its texture having transparency shouldn't mess with the global bounds. ;)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Transparent part of a sprite
« Reply #4 on: July 27, 2015, 09:59:45 am »
Quote
got it thanks, how about localbounds?
Same.

Quote
Wouldn't it be collidable for the transparent parts then? A sprite that is transparent due to its texture having transparency shouldn't mess with the global bounds.
Ok. I realize that I meant "Yes" in my previous answer. Thanks for correcting me ;D
Laurent Gomila - SFML developer

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Re: Transparent part of a sprite
« Reply #5 on: July 27, 2015, 10:12:08 am »
Okay thanks for the answers, I tried it just now and its clear thanks
@Laurent
@SpeCter

Synyster_Coder

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
Re: Transparent part of a sprite
« Reply #6 on: July 31, 2015, 02:00:57 pm »
Hey what your talking about is pixel perfect collision, the intersects function that SFML has built in would act at bounding box collision. I believe that SFML doesn't have pixel perfect collision built into it, I think I remember reading something similar to this before.

Hmm you probably could code it yourself, you have access to all the pixels of your sprite, I'm not sure how efficient it would be but could be a fun project for you I'm sure, teach you a lot more about the basics of collision detection.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Transparent part of a sprite
« Reply #7 on: August 04, 2015, 09:35:47 pm »
I think there's something on the SFML Wiki about pixel-perfect collision, might be worth a look.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything