Fire breathing death
I've got this enemy in a side scrolling endless runner. He spawns off screen on the right at random times and moves from right to left and up and down as he does so. I was hoping to make him breath fire at random intervals or maybe triggered by the proximity of the hero.
I've explored particles although at this stage I haven't managed to offset them to come out at the front end of the enemy (his mouth) – I think I should be able to get this happening by using the method in the tutorial video (below).
My thought with particles is that I suspect that I won't be able to make the particles cause death to the hero. Is this true? I was thinking that if this is the case that I should just do an animated actor that constrains to the fire breathing enemy? I've tried this out by following this tutorial by T Shirt Booth https://www.youtube.com/watch?v=rWQ_E3O5MPg but can't make it work.
The result has been multiple images of my fire actor that don't animate. I've made three different sized versions of the fire and put them in an 'animate' behaviour. Can anyone please help or point me to a tutorial that might help.
Thanks
Comments
You're correct, particles don't have any physics properties and act only as 'scenery' so you can't use them to trigger damage.
What you could do is create your own custom particle effect by spawning and destroying a bunch of little actors and use those actors to trigger your collisions/damage.
You could also use an animated actor like you mention above. I'm not sure why your animate behavior wouldn't be working, can you post the rules?
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Hi @jamie_c
Thanks for the info re particles.. I won't go down that path now. I've posted two grabs of what I've got going on.
I'm looking at that animate behaviour and it looks like the fire images are all the same size. I think it might be resizing them because I know that each one of those images are different sizes.
Actually I just noticed that I'd turned off the animated version. Here's the proper grab
It looks like all of your frames of animation are exactly the same image. To see any animation you'll need to create different frames so you can tell there is movement in the fire.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
PS: Thes fire actors seem to spawn with my fire breather but don't continue to move across from right to left. They just stay on the right side of the screen where they were spawned until the next one is spawned. They all just sort of sit there accumulating.
weirdness
To make the fire move around with your dragon you'll need to add Constrain Attributes to the fire actor that constrain its positions X and Y to the dragon. It looks like you have that in your behaviors but I can't see the rest of the expression. It's in the first screen shots you posted.
Also you have some other Constrain Attributes in the Fire Spawn Rule, you shouldn't need those. The concept would be to use a Spawn Actor Behavior and spawn the actor at the correct location on screen. Use the Position Offsets in the Spawn Actor Behaviors for this. AND in the actor for the animated fire Constrain its locations to the correct offsets for the dragon.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Hmmm, hold the phone. I think a bug has been introduced in the latest version of GS. When I test the Spawn Actor Attribute, the spawn relative to Scene and Actor seem reversed now! If I spawn fire relative to the scene is spawns as though I've chosen relative to actor and vice versa. Can you confirm this?
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
I wonder if I'm going crazy today or what but in testing this I've also found out that my Constrain Attributes does not seem to function now. I have a green (dragon) actor that is constraining it's X location to an attribute but the attribute never updates, as though the constrain is not actually working. See the two screens.
The first screen shows the actor on screen with a display text attribute displaying its actual X location AND the constrained attribute. Note they don't match.
The second screen is the rules that make it happen.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
struggled with this stuff to, (in my case bullets) i ended up with making 2 bullet actors, 1 moving to left and 1 moving to right when pressed left/right.
you can do the same with the flames, just mirror them with an online tool, and make the actor called something like flame_left/flame_right
in case the positioning is not good, you can adjust it by using 'self position x (+10) for example as you used in your screenshots
Hi @jamie_c
I'm starting to get more confused here. My lack of ability shining through again. I've posted another grab showing more of that expression you mentioned.
I'm not sure if I can actually confirm your bug suspicions as I'm lucky if I can follow this at all. I've got some redundant stuff in there – left over from when I tried particles to achieve this affect. I've turned them off though.
I guess I'l just have to go over what you've posted, slowly – as it takes me ages to comprehend this stuff. I was hoping for a video on this like the t shirt booth one – only more relevant. His is all about attaching an energy bar to the hero. I thought that I'd replicated his tutorial – minus the 'life' aspect but maybe not.
This looks like some serious hard slog. Thanks for your input @rvantilborg – I'll mess around with you idea too. This has to be possible.
**Grabs below as I wasn't able to attach them here for some reason***
@jamie_c
Regarding the fire animation.. I checked and they're all different images and all different sizes. When you mentioned different frames, did you mean different images? If you did, then I'm unsure of what's going here either. Is it possible that GS is resizing them as they're being displayed. They're all the same image made in illustrator, just scaled down and then exported as PNGs with the document area sized down to crop tightly around each one.
Your animation frames should all be the same size. When you shrink the flame you should leave the empty space around it. If you crop the image smaller then your images will be scaled up again by gamesalad to the size of your object.
If your animation is simply one image changing size then you could use the change size behaviour as an alternative to animation.
@frd Thanks for the alternative – I just had a bit of a go at that and although I didn't quite make it work at the right size, I got the idea. I think it'd look less fire-like. I think actual animation should create that flickering effect. Of course, I still have to make it work. I think you've made an interesting point about leaving the empty frames after re-sizing. Am looking into it now..
@frd Interesting.. I didn't check 'use artboard' when exporting from illustrator and it cropped. Checked and of course it didn't.
@frd Well that's the animation taken care of – thanks. I never thought that illustrator would crop when exporting – but it does. Still got weird issues with my constrains (or something). I suspect I'll be cooking my brain over this for a while.
I don't know what my problem was yesterday, must have not had enough coffee or something. I've built a demo now and everything is working fine. Use the arrow keys to move left and right and press space to spawn some fire.
As @frd mentions, your frames of animation MUST all be the same pixel dimensions so if you want something to enlarge and shrink you'll need to change the size of the image within the same pixel dimensions as I've done here.
Hope it helps.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Caffeine is your friend.. a friend to beware of, but a friend none the less. Thanks @jamie_c for the demo. I've got 10 minutes left of my 'me time' so I'll have a quick look now and dive into it in more detail when I get more 'me time'. I'll post my results then.
As I just posted a few minutes ago, it's interesting to note that you have to check 'use artboard' when exporting from illustrator if you want to do something like animation – at least if any size change is involved.
PS: just checked out your new site. Looks great, I'll definitely be digging around in there if I ever finish this game. By the way, this game I'm making began as your Buzzy Bee tutorial on YouTube.
It's evolved into something quite different but it did begin it's nebulous life as Buzzy Bee. If I ever get this thing done I'll show you what I've done with it. Of course, I have to actually get it done first.
Hi @jamie_c
I've had a a look at what you've done with the demo you uploaded. It works great with the way your dragon moves.
What I've got is a dragonfly that flies up and down randomly using sine wave. He's also spawned from off the right of the screen randomly. What happens when I apply your rules to mine is that the fire animates successfully and moves with my dragonfly from right to left along the x axis but does not move up and down matching the random y axis movement of my dragonfly.
Also, weirdly with each new dragonfly that is spawned an additional animated fire actor is spawned, so it starts with one, then two, then three etc. I'm not sure how I should make the fire match this movement, and this multiple fire spawning is really puzzling. Any ideas?
They will be the same size, the size of the actor they are applied to.
Thanks @Socks
They were the same size – it was the cropping that was occurring when exporting from illustrator. I didn't notice that there's a check box that gives you an option to include the artboard or not. Would you have any ideas on my last post – I'd really appreciate it. I've attached a couple of grabs that show how my dragon-fly is moving – hope it helps.
Attachment below as it wouldn't let me attach to this post (again).
I've taken a grab of what my dragon-fly is doing. The pink line shows how it's travelling. The fire is animating successfully now. But Isn't following the y axis of the dragon-fly – just coming out at what seem to be points along the y axis and successively more appear as they spawn .. i.e.: 1, then 2, then 3 etc.
What are you currently trying to keep the flame at the height of the dragonfly?
Are there several dragonflies on screen at the same time?
If so they may be fighting over control of the flames. Typically you would constrain the y position of the flame to the y position of the dragonfly, or to a position slightly off-set so that it appears in the right place. If you are using a game.attribute to follow the y position of the dragonfly then you constrain the y position of the flame to that. This only works if there is one dragonfly. For more than one dragonfly on screen you need to distinguish between the dragonflies so the fame knows which one to follow. This could be done by indexing the dragonflies and flames as they are spawned, or by reusing several dragonflies and flames instead of spawning new ones each time, so these indexed actors wait off-screen until they are triggered.
Or maybe I misunderstood the set-up. Any of that useful?
Hi and thanks for the reply @frd . There's only one dragonfly onscreen at a time. I've attached a grab of how I'm trying to constrain the fire to the dragonfly.
And it's following the x but not the y?
@frd yeah - when it spawns from the right it seems to be appearing at various y points that the dragonfly moves along as it moves up and down, and moving across to the left on that same y axis.
What are the spawning rules? Where is it set to spawn from?