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

Author Topic: Treating all sprites in a group as one sprite  (Read 2149 times)

0 Members and 1 Guest are viewing this topic.

StormWingDelta

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Treating all sprites in a group as one sprite
« on: May 03, 2014, 07:39:25 pm »
Been curious about this for a while and I know it involves list or arrays but what else?  Got several games I've been tinkering with and one involves a  Bejewelled-like setup but instead of the blocks vanishing and clearing the way for more they turn into boosters and try to shove the bricks above them and themselves off the map.  The issue here is syncing groups of sprites so they move as one even if another slams into them or more start adding thrust.

Anyone ever do this before or have ideas how?
I have many ideas but need the help of others to find way to make use of them.

didii

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: Treating all sprites in a group as one sprite
« Reply #1 on: May 04, 2014, 12:51:48 pm »
Never did this myself, but my guess is to replace all bricks with 1 new object which holds a vector of all the locations. In the collision check, this object should be regarded as 1 object so it will not interact with itself.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Treating all sprites in a group as one sprite
« Reply #2 on: May 04, 2014, 02:06:15 pm »
Custom sf::Drawable derivate that holds and draws multiple sprites?

Although I would probably separate the logical represenation (jewels, blocks being connected) from the graphical one.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

StormWingDelta

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Re: Treating all sprites in a group as one sprite
« Reply #3 on: May 04, 2014, 11:14:44 pm »
Had issues seeing this myself so I drew it up. :)

Hope this helps:


Green = not moving
Yellow = thruster moving up
Red = meteor falling down
blue = moving with thruster group or falling group
I have many ideas but need the help of others to find way to make use of them.