[help] Muzzle Flash Follow-Position

peter037

  • Posts: 7
Hey guys new to stencyl had a couple questions. (loving stencyl so far btw)


Been having an issue getting my muzzle flash to follow my boss character as it moves around the scene. if anyone can help or shoot me a couple links that may help me get muzzle flash to follow the boss thatd be epic and greatly appreciated!! Thanks in advance guys.




this is what im doing:
I'm using a Scene Behavour i made to spawn a boss after x seconds. (there are no actors placed in the scene aside from the Player actor). The boss shoots and moves perfectly, but the muzzle flash doesn't move. the muzzle flash spawns but stays where it spawned.

Ive tried a few and was using a tutorial on stencylworkouts (link below) i found, but because the boss isn't actually in the scene, i cant use the tutorial effectively. or maybe im just not doing something right (calls for an 'actor' that needs to be in the scene).  the tutorial shows a 'light' being attached to the 'player' who's placed in the scene. but my boss isn't placed in the scene, he spawns after x amount of time.


my set up is a little different on the boss:
Behaviour 1:
i got the boss timed to trigger a message to 'shoot',
Behaviour 2:
when 'shoot' is triggered its spawns and shoots the projectile and spawns the muzzle flash (muzzle flash stay in place where it spawns).

tutorial i was using:
http://stencylworkouts.blogspot.ca/2012/12/light-follow-player-in-stencyl.html


so far in stencyl:
i have a understanding kinda, and thats being generous lol. so you guys know kind of where im at, i've been opening behaviours and looking at them and making my custom behaviours out of them and learning how everything works together that way, i've been following tutorials as well. SO FAR my game has random spawning enemies, score/highscore, unlockable achievements, unlockable/playable characters w/ their own bullets, and just about everything is animated lol

Tuo

  • *
  • Posts: 2469
When you want a second actor to follow around a first actor, one method is to use the code for the second actor to save the first actor as an actor attribute. Then, keep setting the x/y of the desired actor to be the x/y of the stored actor (+/- amounts to get the position to be where you want).

In the StencylForge's game section, I have a "Demo- Dress Up Game", which goes over the basic idea (although you'll have to figure out the appropriate +/- amounts).
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)