Help needed for effect when a variable is over a certain number

Discussion in 'Game Mechanics Design' started by Eff-n-Geoff, Mar 9, 2016.

    Tags:
  1. Eff-n-Geoff

    Eff-n-Geoff Veteran Veteran

    Messages:
    178
    Likes Received:
    7
    First Language:
    English
    Hi there, this one is taxing me a little ...


    I have a variable that is sporadically increased throughout the game when certain events occur. It is also constantly reduced by one every 60 frames.


    When that variable goes over 60, I would like it to trigger a visual effect


    If that variable goes over 80, I would like it to trigger a different visual effect.


    My problem arrives when the variable goes to (for example) 90. This would force both the 60 and 80 visual to trigger constantly until the number gets below 80, and then 60.


    How can I ensure that if the variable goes over 60, the visual effect only happens once. Then if it goes over 80, that only happens once.
     
    #1
  2. sartha

    sartha Veteran Veteran

    Messages:
    31
    Likes Received:
    6
    First Language:
    English, French
    Actually quite simple...


    Make your event something like this:


    If : Variable 1 >= 80


      Remove level 1 visual effect


      Apply level 2 visual effect


    Else


      If : Variable 1 < 60


        Remove level 1 visual effect


        Remove level 2 visual effect


      Else


          Apply level 1 visual effect


          Remove level 2 visual effect


      End


    End


    If the effect is meant to be persistent (like the screen going red from rage) then that's all you need, if it's meant to just happen briefly when passing the threshold (like a flash) then you need to make a second event that specifically triggers the event then gets switched off.
     
    #2
  3. Balako

    Balako PattyCake assosiation Veteran

    Messages:
    220
    Likes Received:
    119
    First Language:
    Arabic
    Primarily Uses:
    N/A
    if variable ==61


    run visual effect 1


    wait (frames)


    remove visual effect


    else


    if variable ==81


    run visual effect 2


    wait (frames)


    remove visual effect


    else


    if variable ==91


    run visual 3


    wait (frames)


    remove visual effect


    ..... etc etc


    this would work if you want the visual to show once then goes off, or use the one on the comment above for the constant one....i think this is basically the idea ..


    please tell me if its not what you needed :D
     
    #3

Share This Page