Dynamic attacks and energy meters

FrantoFranto Member Posts: 779
edited January 2014 in Working with GS (Mac)
Hey, I managed to make a meter that drains while an attack is in use, as well as an icon showing number which affects the
characters running speed. What do you think?



Some move testing of the other character.



Edit: I've also managed to make attacks that change size attributes as the number in the top right hand corner changes, it's really neat, but graphically, it gets a bit wonky, lol.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    The speed display is too flickery and chaotic. Maybe make the main player actor change colors to denote different speeds? Or just have a vertical meter/bar for speed.

    Second video is set to "private."

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • FrantoFranto Member Posts: 779
    Ah, thanks for the feedback. I put the kph display for fun, but since I had put the x-speed value as a real attribute, it shows up with decimals and changing it to an integer attribute makes me fear how many behaviors I would have to go around and fix for it. Only solution is to go into the display text's editable area, and figure out a formula that rounds it out to a whole number. Isn't there something among the functions section that rounds out numbers to the nearest whole?

    As for the flickering, I could create a behavior to constrain the displayed text for at least a full second before changing again.

    The player actor changing colors is a viable solution. Although, I really want the speedometer, so I'll have to fix it to look more visible and less flickery. A robot game I use to play had a speedometer, and I always thought it was neat being able to hit over 500 kph all time, and if going past the speed of sound, you'd hear the sound barrier screeching.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2014
    floor(expression) will round down to the nearest whole number.
    ceil(expression) will round up to the nearest whole number.
    prec(expression,x) will round up or down to the nearest whole number if x is 0. Otherwise, it will round to the nearest decimal point (e.g. if x is 3, it will round to the thousandth: 0.4378=0.438).

    One way to limit the flickering is to interpolate from the current speed to the next speed over a certain duration and possibly, as you said, to only do so every second or thereabouts.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • FrantoFranto Member Posts: 779
    Ah, I see, thanks! Floor, ceil, and prec will be very useful.
  • slowcutslowcut Member, PRO Posts: 164
    You can also use the padReal expression to limit the digits.

    For example if game.speed is 123.4567

    padReal(game.speed,3,2) will return 123.45
    padReal(game.speed,3,1) will return 123.4
    padReal(gamespeed,3,0) will return 123

    This could calm down your speed display

Sign In or Register to comment.