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

Author Topic: How to Delete/Remove Sprite?  (Read 6240 times)

0 Members and 1 Guest are viewing this topic.

idontmakesense

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • Email
How to Delete/Remove Sprite?
« on: February 26, 2014, 11:02:24 am »
mySprite.setTexture(NULL) gives syntax error.

Any alternatives?

Rhimlock

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: How to Delete/Remove Sprite?
« Reply #1 on: February 26, 2014, 11:05:34 am »
You dont have to Remove a sprite.

What do you want to achive by doing something like that?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to Delete/Remove Sprite?
« Reply #2 on: February 26, 2014, 11:07:19 am »
You should probably learn basic C++ instead of trying random things. You can remove something from another data structure like an STL container, but not "on its own".
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

idontmakesense

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • Email
Re: How to Delete/Remove Sprite?
« Reply #3 on: February 26, 2014, 11:13:25 am »
Sorry to be unclear. Its my first attempt making a game and coding on sfml.

I have a "car sprite" which on collision with a "bullet sprite" should, well, for now disappear/get removed/get deleted.
 
Any help on how to achieve that?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: How to Delete/Remove Sprite?
« Reply #4 on: February 26, 2014, 11:17:38 am »
If it shouldn't appear on the screen anymore, don't draw it to the screen. And yes, acquire a solid C++ understanding first. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything