Sign in to follow this  
onefatman

Anchoring elements to sprites

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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.