GameSalad

trying to improve an effect in my game...

AdrenalineAdrenaline Posts: 490Member, BASIC

Hi all, I'm trying to improve the visuals on an effect in my game. It's a simple horizontal bar that fills up to show how many points were just scored, and then it empties again.

Example: you just scored 2000 points. The bar will fill from left to right to the point that coincides with 2000. When it hits this point, it will pause for an instant and then go back down to 0 until you score again. I am achieving this effect using Replicate. I am replicating a 1px actor in the 0 direction, and setting the "copies" to an attribute tied to the points value. Then, I'm using an interpolate behavior inside a timer to bring that attribute back down to 0.

The above method works fine, but what I'd like is something more interesting.

I'd love to have the bar fill with an animation in its height, so it looks like there's a pulse that pushes the bar towards the correct value. Like a heart monitor, for example. This would require dynamically adjusting the height of only the 1px actors that should respond according to the amount of points scored....but that's not an option since I'm using Replicate. Has anything like this been done before? Or does anyone know of the best way to achieve this?

Thanks in advance!

Comments

  • Braydon_SFXBraydon_SFX Dallas, TexasPosts: 8,876Member, Sous Chef, PRO, Bowlboy Sidekick

    Maybe something like this will help?

  • JapsterJapster Posts: 303Member, PRO
    edited June 26

    @Adrenaline - can you not use the above, or similar method, and possibly have a tiled/set size image/animation (so it doesn't stretch), that fills up by increasing size, and when full or nearly full, run a quick pre-designed animation of the pulse?

    alternatively, could you hide 1 / 2 more actors behind, and have them replicate too (but at 2/3 pixel spacing, but each cycle their images once full (think eg. dark, medium, light red, all offset by 1 image), to give a pulse/cycling effect?) (Note - ie. 1 actor in front = 1 pixel of colour, 2 transparent, 2nd actor = 2 pixels of colour, 1 transparent, and third/furthest back = 3 pixels of colour, so layered colour cycle, etc...)

    Of course, this effect could simply be done as an animation, but the images could be anything, including blended, chevrons, etc, the method would work well a chevron-shaped 'pulse' effect, but of course it would be recurring across the bar...

    Another option is why not just have your 'pulse' as an actor that runs along/overlaid on top of the bar when full? :smile:

  • AdrenalineAdrenaline Posts: 490Member, BASIC

    Thanks @Braydon_SFX but that's just a horizontal version of what I already have :lol: It is helpful, but I plan on using that method as a fall-back if I can't achieve this other thing...

    @Japster , thanks for your ideas too! It's not what I had in mind, but it's something to consider and worth looking into. This would achieve a different kind of pulse effect. Cool.

    I think my first post was a bit unclear, apologies for that. When I said pulse, I was imagining something like a whip or a shockwave...like doing the wave in a crowded arena/sports stadium! Let's use that analogy --- an american football stadium.

    Let's say the stadium will do the wave after every play. But the amount of people who will stand and participate in the wave each time is determined by how many yards were gained on the play. If it's a touchdown, everyone participates! You wait for the dude to your right to stand --- then you stand while he sits --- then you sit while the dude to your left stands --- etc. BUT if the play didn't gain enough yards, you might not have to participate in the wave at all.

    If that doesn't make sense (I've been known to muddy things further when trying to explain), then I'll go back to my cave and return, either with proof of success or news of failure haha.

  • IceboxIcebox Posts: 1,363Member, PRO

    Do you mean something like this ?

  • JapsterJapster Posts: 303Member, PRO
    edited June 26

    @Icebox - I think @Adrenaline means this, mate:-

    ...or the first half of this animation....

    Could you just have an actor image of the 'wave' travel along the bar, starting from 1 px width, quickly going to the actual width of the wave itself, then shrinking back to 1 px width at the end, with no transparency where the bar is, so you get the effect of the bar performing the 'wave'?

    Either that, or have 3 layers - lowest = bar content, 2nd = wave, 3rd = surround, and just have it travel along with less worry about it suddenly appearing from the left, fully formed?

  • SocksSocks London, UK.Posts: 12,698Member, PRO

    @Adrenaline said:
    If that doesn't make sense (I've been known to muddy things further when trying to explain), then I'll go back to my cave and return, either with proof of success or news of failure haha.

    :)

    Must be honest, I didn't understand either of your explanations !

  • AdrenalineAdrenaline Posts: 490Member, BASIC

    @Icebox sorta, but in your example you can see the zig-zag that's going to be filled - that's not the effect I'm going for. Thanks though!

    @Japster yes, that's it! I follow your first suggestion (1px width, quickly going to actual width, then back to 1px again). That's a good idea I hadn't thought of. I can give it a shot later.

    I don't completely follow your other suggestion (3 layers), but I'd like to understand that one too. What do you mean by 'surround'?

  • AdrenalineAdrenaline Posts: 490Member, BASIC

    @Socks said:

    @Adrenaline said:
    If that doesn't make sense (I've been known to muddy things further when trying to explain), then I'll go back to my cave and return, either with proof of success or news of failure haha.

    :)

    Must be honest, I didn't understand either of your explanations !

    I don't think you're alone there, haha. My fault.

  • JapsterJapster Posts: 303Member, PRO

    @Adrenaline said:
    @Icebox sorta, but in your example you can see the zig-zag that's going to be filled - that's not the effect I'm going for. Thanks though!

    @Japster yes, that's it! I follow your first suggestion (1px width, quickly going to actual width, then back to 1px again). That's a good idea I hadn't thought of. I can give it a shot later.

    I don't completely follow your other suggestion (3 layers), but I'd like to understand that one too. What do you mean by 'surround'?

    no worries - this is the method I was thinking for your wave:- Low CPU, easy:-

    The layers - do you mean the cycle, or the 3 layers I mentioned as regards above? -I just meant that you could use a layer to 'hide' the beginning and end of the wave's journey, behind opaque side sections of your bar, kind like the left and right edges of a window/doorframe, looking through it, with your wave then starting and ending just out of sight either side, just so it doesn't suddenly appear in view, but more seems to morph into and out of existence... :smile:

    I'm not the best at explaining either... :frowning:

  • AdrenalineAdrenaline Posts: 490Member, BASIC

    That makes sense now, I understand! :) Thank you!

  • JapsterJapster Posts: 303Member, PRO

    Good stuff! - Of course, for the full effect, if you're just using a colour (without my top bar bit in the example, you could also increase the height of the actor you're moving (ie. from 0 to the full height), so you get a 'raising up into a wave' effect, and reverse at the other end? :smile:

Sign In or Register to comment.