Creating A Rainbow Mode Effect, Best Way???

Hey GS,

So in my game I want to create a mode called rainbow mode that occurs when you collect something. The objects and everything in the scene go through random colors creating a rainbow effect and possibly a rainbow trail behind my character almost like nyan cat, lol. Just trying to figure out the best way to accomplish this and if others have done this how they went about accomplishing this.

I know there are plenty of game examples of what I want to accomplish but can't really think of any off the top of my head. The only example of what I want to pretty much accomplish that comes to mind is Pac-Man Championship Edition. Below is a picture. Thanks in advance for your guys input!

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2015

    You could constrain each of the RGB channels of your objects to a 'clipped' sine wave (a sine wave with the top and bottom squared off), and then offset each of the channels by 120° . . . . this will make your objects (preferably white) cycle through the spectrum . . . . then add a further offset to the angle that sin operating on based on the position of the object on the screen . . . this will give you a sweeping rainbow moving across the screen. Although depending on your project it might be a little too many constrains ?

    Hope that makes sense !

  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2015

    . . . . . . . . . . . .

  • SocksSocks London, UK.Member Posts: 12,822

    Or maybe you could just use a rainbow image overlay set on Multiply ?

  • LovejoyLovejoy Member Posts: 2,078

    @Socks said:
    You could constrain each of the RGB channels of your objects to a 'clipped' sine wave (a sine wave with the top and bottom squared off), and then offset each of the channels by 120° . . . . this will make your objects (preferably white) cycle through the spectrum . . . . then add a further offset to the angle that sin operating on based on the position of the object on the screen . . . this will give you a sweeping rainbow moving across the screen. Although depending on your project it might be a little too many constrains ?

    Hope that makes sense !

    There goes @Socks‌ again speaking klingon.

    That video is so sweet my teeth fell out.

    Fortuna Infortuna Forti Una

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291

    Thanks @Socks,

    that video shows the exact thing I want to accomplish. Did you just make that and the video??? If so, thank you! You always seem to have the right answers for me @Socks‌ and for that I am forever grateful!!! I almost love you but don't want to get weird, :p HAHAHAHAHA

    I can't thank you enough and will be trying this out when I get home!!!

  • SocksSocks London, UK.Member Posts: 12,822

    @jonmulcahy said:
    woah

    @Lovejoy said:
    That video is so sweet my teeth fell out.

    I'm always surprised what people think is impressive (or cool, or whatever), this is just the same old rotating spectrum thing done a million times !

    @KillerPenguinStudios said:
    I almost love you but don't want to get weird.

    I'll be double locking the doors and windows tonight.

  • SocksSocks London, UK.Member Posts: 12,822

    By the way, it would be much more efficient (I've tested this idea a lot on actual devices) if you animated a block of colour moving 360° through the spectrum - and use that on your actors (where applicable) instead of three constrain behaviours.

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291

    @Socks said:
    I'll be double locking the doors and windows tonight.

    HAHAHA, No need for that. I'll be too busy game developing to go anywhere. I'll be locked down in my room! HAHAHA!!!

  • AdrenalineAdrenaline Member Posts: 523
    edited May 2017

    @Socks said:
    You could constrain each of the RGB channels of your objects to a 'clipped' sine wave (a sine wave with the top and bottom squared off), and then offset each of the channels by 120° . . . . this will make your objects (preferably white) cycle through the spectrum . . . . then add a further offset to the angle that sin operating on based on the position of the object on the screen . . . this will give you a sweeping rainbow moving across the screen. Although depending on your project it might be a little too many constrains ?

    Hope that makes sense !

    @Socks, could you please give an example of this? The video in this thread is no longer available and I'm interested!

    Thanks!

    edit:

    I found another thread where you answered the same thing! Your solution is pasted below, I adjusted it where necessary. Thanks again.

    R to sin(vectorToAngle(self.X-game.baseX, self.Y-game.baseY))+0.5

    G to sin(120+(vectorToAngle(self.X-game.baseX, self.Y-game.baseY))+0.5

    B to sin(240+(vectorToAngle(self.X-game.baseX, self.Y-game.baseY))+0.5

  • SocksSocks London, UK.Member Posts: 12,822

    @Adrenaline said:
    @Socks, could you please give an example of this? The video in this thread is no longer available and I'm interested!

    I can't give you an actual GameSalad example (too poor to afford GameSalad at the moment), but I can explain the overall theory as is applicable to GameSalad if you want ?

  • AdrenalineAdrenaline Member Posts: 523
    edited May 2017

    @Socks said:

    @Adrenaline said:
    @Socks, could you please give an example of this? The video in this thread is no longer available and I'm interested!

    I can't give you an actual GameSalad example (too poor to afford GameSalad at the moment), but I can explain the overall theory as is applicable to GameSalad if you want ?

    No need, but thanks anyway :smile:

  • SocksSocks London, UK.Member Posts: 12,822

    @Adrenaline said:

    @Socks said:

    @Adrenaline said:
    @Socks, could you please give an example of this? The video in this thread is no longer available and I'm interested!

    I can't give you an actual GameSalad example (too poor to afford GameSalad at the moment), but I can explain the overall theory as is applicable to GameSalad if you want ?

    No need, but thanks anyway :smile:

    Good ! It involved graphs and sine waves and a picture of a rainbow.

    :)

Sign In or Register to comment.