Cycle actor colour over and over like a rainbow effect

ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
edited February 2012 in Working with GS (Mac)
Hi guys

I am trying to get an actor who floats onscreen from the left to change colour every second.

It's main colour is red and I thought the below idea might have worked but it doesn't

image

That doesn't make any difference...thought it might make the colours cycle through... :(

Does anyone else have any other ideas?

Many thanks

ZB

It takes a Zombie to know a Zombie!!!

Comments

  • MantoManto Member Posts: 796
    Hi. Do you want a specific cycle or random cycle?
  • CloudsClouds Member Posts: 1,599
    edited February 2012
    To cycle through the rainbow (spectrum) you would need to do this . . .

    Red is on - animate blue up - green is off
    animate red down - blue is on - green is off
    Red is off - blue is on - animate green up
    Red is off - animate blue down - green is on
    animate red up - blue is off - green is on
    Red is on - blue is off - animate green down

    Rinse and repeat . . .

    I am sure you could simply write some math magic to do it for you, probably just three constrain behaviours, no need for a timer . . . .

    Let me have a go . . . back shortly
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    HI Manto

    No, a random effect would cool...

    It takes a Zombie to know a Zombie!!!

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Thanks Tynan

    I rainbow effect would be cool too...

    It takes a Zombie to know a Zombie!!!

  • CloudsClouds Member Posts: 1,599
    edited February 2012
    Here you go . . .

    Constrain Red to (sin(time*300)/2)+0.5
    Constrain Blue to (sin((time*300)+150)/2)+0.5
    Constrain Green to (sin((time*300)+300)/2)+0.5

    The first 300 number is the speed at which you cycle through the rainbow.

    Actually, hold on a second . . . let me try it in Gamesalad to see if it actually works !!!
  • CloudsClouds Member Posts: 1,599
    edited February 2012
    It works fine (if you want to cycle through the colours of the rainbow)

    Here you go:

    http://www.mediafire.com/?09mnntti8fk69bd
  • MotherHooseMotherHoose Member Posts: 2,456
    edited February 2012
    the Timer and color changes need to be on the Actor that you want to change colors …
    that is the actor that is spawned … the Red-Man

    darn computer is so smart … and can't even figure out what we mean! @-)

    @};- MH

    EDIT: aha! @Tynan … another beautiful and fascinating creation!
  • Rob2Rob2 Member Posts: 2,402
    @Zombie (....!) Your timer group works fine (but will only operate under the enclosing rule condition) - if you want more variation try random(0,100)/100
  • Rob2Rob2 Member Posts: 2,402
    oooh @MH and Tynan I need to refresh more often...
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Impressive, Tynan! (I'm always impressed with any rules with sin or cos.... I could never get the hang of trigonometry in school.... algebra yes, trig no.... must be the way my brain's wired! :D

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

  • CloudsClouds Member Posts: 1,599
    "I could never get the hang of trigonometry in school.... algebra yes, trig no.... must be the way my brain's wired!"

    Same here, never gave it much attention until I started to learn Gamesalad, sine and cosine are pretty simple things and quite useful.
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Tyran...you the man!!!

    That's amazing work dude and thanks so much for taking the time to work the slick s*%t out!

    It takes a Zombie to know a Zombie!!!

  • MotherHooseMotherHoose Member Posts: 2,456
    @gyroscope … your brain wiring is perfect!
    problems in getting the hang of Trigonometry is due to your teachers' giving you a bunch of new terms without anything to hang them on!

    sine (sin); cosine(cos); tangent (tan); theta; adjacent; opposite; secant; cosecant; cotangent …
    while your brain already knows that sin is evil; cos might be slang for because; tan is what you do at the beach; adjacent means next to; opposite mean across the street; and the rest of them are gibberish! … and though your brain knows that a clockwise goes to the right … how come in trig the angle theta is drawn counterclockwise?

    note: in the new College Trig class by HAAC (free in iTunes U) the professor does away with adjacent/opposite and uses X,Y … =D>

    failure to learn is often the result of failure to teach … and Trig is easier to grasp, if your native tongue isn't English!

    @};- MH
  • CloudsClouds Member Posts: 1,599
    edited February 2012
    @Zombiebrains

    "That's amazing work dude and thanks so much for taking the time to work the slick s*%t out!"

    No problems, I only want 65% of the revenue from your games by way of a thank you (Apple take 30% so I thought I would leave you something).

  • CloudsClouds Member Posts: 1,599
    edited February 2012
    ...
  • CloudsClouds Member Posts: 1,599
    "sine (sin); cosine(cos); tangent (tan); theta; adjacent; opposite; secant; cosecant; cotangent …
    while your brain already knows that sin is evil; cos might be slang for because; tan is what you do at the beach; adjacent means next to; opposite mean across the street; and the rest of them are gibberish! … and though your brain knows that a clockwise goes to the right … how come in trig the angle theta is drawn counterclockwise?


    Yep, all the gibberish and esoterica kills any chance of getting a handle on all that crap.

    I like to think of sin as a value that moves from -1 to +1 to -1 to +1 ( . . . . etc and so on) - that's all you need to know to make circles and weird squiggly shapes.
  • CloudsClouds Member Posts: 1,599
    edited February 2012
    ...
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2012
    @MotherHoose said: @gyroscope … your brain wiring is perfect!

    Well, I wouldn't say that, some days, but thanks all the same, MH!!! :-)

    @Tynan, hi, I downloaded your rainbow 5 game salad file when the link was there; I think it's terrific; the link is now gone, I guess you've changed your mind about making it freely available (which is fair enough)

    I have a project that's been simmering for a while now that I keep tinkering with - it'll see the light of day one day - anyhow, I've already got permission from Ludwig to use his algorithms from his pattern generator; your rules/algorythm in the rainbow 5 game file would be perfect as well. Would you give me permission to use it please? If not, I'll understand but if you do I'll gladly put your name (and a website reference if wanted) in the credits. For info, it wouldn't be a major part of the app, just another visual effect amongst the many others (but an excellent one all the same!) :-)

    Only one thing, this simmering project will have to simmer for quite a while longer before its anywhere finished...

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

  • CloudsClouds Member Posts: 1,599
    edited February 2012
    "hi, I downloaded your rainbow 5 game salad file when the link was there; I think it's terrific; the link is now gone, I guess you've changed your mind about making it freely available (which is fair enough)

    Not at all ! 8-X ;) I often get carried away and can easily hammer out 2-4k words on just one subject (seriously), once I am off you can't stop me (although a tranquilliser gun helps) - I noticed I was starting to fill the thread with yet more waffling, rambling, lengthy and verbose posts so I killed off the extraneous stuff - but help yourself to the algorithm, it's only a move and a rotate, do what you want with it, no need to put me in any credits - play around with the values yourself, a little tinkering you can come up with all sorts of nice stuff.

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2012
    @Tynan wrote: "Not at all ! I often get carried away and can easily hammer out 2-4k words on just one subject (seriously), once I am off you can't stop me (although a tranquilliser gun helps)"

    Haha! :-)

    @Tynan wrote: "it's only a move and a rotate"

    Ah yes, but it includes that dreaded trigonometry stuff that my math(s) teacher couldn't get through to me into my head (all those years ago....) ;-)

    Most kind of you Tynan, thank you for use of! I've already had a tinker ....... there's a joke there somewhere ..... of your game file, it's interesting to see all the variations. Thanks again! :-)

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

  • CloudsClouds Member Posts: 1,599
    edited February 2012
    "Ah yes, but it includes that dreaded trigonometry stuff that my math(s) teacher couldn't get through to me into my head"

    It really is simple, here's a simple way of viewing 'sin'.

    Sin is a value that simply goes from -1 to +1 then back to -1 and back and forth forever. That's all it does.

    Plus makes things bigger, minus makes things smaller, divide chops stuff into smaller pieces, sin makes things bigger then smaller then bigger then smaller (etc).

    So once you have something that oscillates back and forth like that you can use it to move a ball left and right or up and down or get an object to fade in and out and so on - you can decide how fast you want it to move back and forth and how far back and forth it goes.
  • CloudsClouds Member Posts: 1,599
    Oh god, I am off again . . . . must stop typing . . . must stop typing . . .
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2012
    It's all right Tynan, just prepping the tranquilliser gun now .... :-)

    Thanks for your explanation, that sounds straightforward enough.... I've had it in my head all these years that sin, cosine etc are to do with tangents which are to do with vectors.... etc., you know, distances and angles and arcs; I got it wrong way back then and have been in the dark... until now!

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

  • CloudsClouds Member Posts: 1,599
    edited February 2012
    "It's all right Tynan, just prepping the tranquilliser gun now ..."

    My face, not my beautiful face, go for the flanks.

    " I've had it in my head all these years that sin, cosine etc are to do with tangents which are to do with vectors.... etc"

    Well strictly speaking they are really to do with triangles and related stuff, but the above way of viewing them (a value moving back and forth between -1 and +1) is a more useful way of thinking about them.

    If you keep adding 1 to the value that controls an object's X position, it will move in the X direction as you continue adding 1.

    If you keep adding 1 to the value of 'sin' and, it is controlling the object's X position, it will move 1 unit to the right and then 1 unit to the left (and so on) as you continue adding 1.

  • aumaum Member Posts: 8
    Hi Tynan,

    is it possible that you cold provide a new link to your rainbow color cycling solution as the link you gave earlier ( http://www.mediafire.com/?09mnntti8fk69bd ) dosent work any more.

    Thank you in advance.

    AUM
  • RD2012RD2012 Member, PRO Posts: 45
    Hi Tynan,

    Any chance you might be able to post a link or a screen shot of your code for your rainbow color cycling solution? You gave a link but sadly, it doesn't work anymore.

    Thanks so much!

    RD2012
  • simo103simo103 Member, PRO Posts: 1,331
    @aum and @RD2012 .. sadly we no longer have the genius input of Tynan ... however I dug in my files and believe I had that demo file so I have thrown it up on my GS resource page here : http://www.funkymunkygames.com/GameSalad/search/
    Labelled Color Blocks on the right!
  • RD2012RD2012 Member, PRO Posts: 45
    Thanks simo103! That was a huge help. Much appreciation!
Sign In or Register to comment.