Flashing Text in GS

LeonardDeveloperLeonardDeveloper Member Posts: 4,630
edited January 2012 in Working with GS (Mac)
Dear All,
Ive seen flashing text, Ive tried putting a timer and an change attribute>alpha Behaviour but it doesn't work, Does anyone have any idea how i could do this?
_______________________
My second question instead of just changing the alpha is there any transition that i could make that would make text flash in...??
Any help is appreciated,
Thanks,
Jack

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    make a attribute called FlashText or whatever you want and set it to 0

    then have a timer every 1 second (or however long you want the flash duration to be)
    change attribute FlashText to (FlashText+1)%2

    then have a rule when attribute FlashText=1
    change attribute self color alpha to 0
    then in the otherwise section of that rule put another change attribute behavior and change the alpha to 1

    see if you like that

    cheers


  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    hahah ;)

    the xbox is overheating every 2 minutes for some reason so i got nothing else to do on this saturday now. im going threw cod withdrawls!
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    edited January 2012
    @tshirtbooth
    Thanks very much help is very much appreciated! :)
    @Johnpapiomitis
    On the coffee i see! :) (Modern warfare 3 is the best! :) Help is appreciated
    @Tshirtbooth Games on the mac are the best! :)
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited January 2012
    Hi Jack, try something like the following:

    Make a boolean (unchecked) called Flashing.

    Rule
    When Flashing is false
    Timer after ---set your flash time ---
    Change attribute Flashing to true
    Change attribute self.Alpha to 0

    Rule
    When Flashing is true
    Timer after ---set your flash time ---
    Change attribute Flashing to false
    Change attribute self.Alpha to 1

    hope that helps out. :-)

    Edit: beaten to it by an army of people... !

    ----------------------------------------------
    http://davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    @gyroscope
    They beet you too it!! Thanks for the help anyway its much appreciated! :)
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    Can anyone answer my other question:
    "My second question instead of just changing the alpha is there any transition that i could make that would make text flash in...??
    Any help is appreciated,"
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited January 2012
    well when i think of a flash i think of a blink on and off which is what we all said would do. You could interpolate the alpha instead of change for a fade in and out transition if thats what you mean. Or you could animate it, or have another actor behind the actual text thats just a light image or whatever that has the rules we said above so in it instead of in the actual text actor so the text will always be there but the light is whats flashing on and off. It really depends on how you want it to look.
  • CloudsClouds Member Posts: 1,599
    edited January 2012
    Even more simple:

    image
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    D'oh!!

    Nice one, Tynan; providing there aren't too many other "Every" timers this is poifect!!

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • CloudsClouds Member Posts: 1,599
    @ Gyroscope

    Do having too many 'Every' timers slow GS up ? Or do they screw stuff up some other way (like throwing out the timers sync) ?


  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    @ Tynan

    yeah too many timers can slow it down

    Also nice one with the 1-, i personally use modulo as i posted above, becuase its a really nice habit to get into for making toggles, switching states, and whatnot, but good one non the less

    cheers
  • CloudsClouds Member Posts: 1,599
    @ JohnPapiomitis

    "yeah too many timers can slow it down"

    Cheers, good information to know !
  • PixelgunPixelgun Member Posts: 111
    My understanding of modulo is limited, math was never my strong suite. Do you use (self.flash+1)%2 because there are two states? Would you do the same thing, instead using %3, if you had three states you wanted to change. For instance changing the color of the text between red, green, and blue?

    Can you reduce this specific application to a more general principle? :)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    @ Pixelgun

    yep its %2 because that will switch it between 2 states, 0 and 1. If you had %3 it would go 0,1,2 then back to 0, if you had it %4 it would go 0,1,2,3 then back to 0.

    Hope that helps
  • CloudsClouds Member Posts: 1,599
    edited January 2012
    @ Pixelgun

    "For instance changing the color of the text between red, green, and blue?"

    How would you use the numbers 1, 2 and 3 for changing the color of the text between red, green, and blue ?

    The only way I can think of is to change the RGB channels independently - or are you simply referring to swapping images or something like that ?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    yeah you have to change all 3 of the color channels to make sure you get the correct color. So:

    You would have your attribute called setColor or whatever you want to call it. Change the attribute to (setColor+1)%3 to toggle threw 0,1,and 2 then back to 0.

    Then have rules when setColor=0
    change attribute self color red to 1, change attribute self color green to 0, change attribute self color blue to 0 (that will make it red

    when setColor=1
    change attribute self color red to 0, change attribute self color green to 1, change attribute self color blue to 0 (that will change it to green)

    when setColor=2
    change attribute self color red to 0, change attribute self color green to 0, change attribute self color blue to 1 (that will change it to blue)
  • CloudsClouds Member Posts: 1,599
    @ JohnPapiomitis

    Cheers John, yeah I know all the colour stuff (although I not thought of doing via a (XXXX) % X rule).

    What I would really like to do is to be able to generate a random number between 0 and 1 (0.056 for example) that I could use to change one of the colour channels - (rather than just 0 and 1)

    ?

    I suppose I just need to generate a larger random number (let's say 1-100) and then divide by 100 ?
  • CloudsClouds Member Posts: 1,599
    Yes (generate a larger random number (let's say 1-100) and then divide by 100) - it works !

    Sometimes you just need to type out stuff and it helps . .
  • PixelgunPixelgun Member Posts: 111
    edited January 2012
    @ JohnPapiomitis That's how I thought modulo worked but never having used it I wasn't sure. Thanks for clearing that up for me!
    someone should do a series of tutorials on how to use all the functions. :)
Sign In or Register to comment.