Jump to content

Anchoring elements to sprites


onefatman
 Share

Recommended Posts

Hey all,

 

Is there a way to anchor an object (Sprite, Emitter, Image, etc) to a Sprite so that they obey the commands issued to it as if they were one object?

 

I know in theory there's a way to add a bunch of sprites to a group and to manipulate the order of the elements inside of it but I've already built a bunch of pretty advanced controls that rely on Sprite movement/position etc. so I'm trying to avoid having to refactor it.

For some context, it's a hero sprite with movement & animation, and I'm trying to add a static jetpack that sits behind (z) the animation, and then an emitter that sits just under (y) the jetpack that spits out fire particles as you thrust upwards. 

So far I've tried:

  • adding the jetpack as a child of the original sprite, but it's always in front as the hero animation is a texture (side note: tried setting the blendMode of the jetpack to show the texture through it but this doens't work either)
  • updating the jetpack & emitter's x/y values onUpdate, but this leaves a lag that makes them float around and not rigidly adhere
  • adding the hero sprite as a child of the jetpack (it allows for the jetback to appear behind the hero, but it screws up my original code as well)
  • praying to the sky gods for good fortune and wellbeing

Any better ideas?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...