0 Favourites

Limit Colour palette

  • Hey guys, anyone who any way to limit the colour palette that Construct 2 uses?

    I'm making a 8-bit game using the NES colour palette, and I'm using the inverse effect for enemy sprites, but the inversed colours aren't consistent to the colour palette. Anybody know how to limit the colour palette that effects use?

    EDIT: Alternatively, anybody know how to do something like,

    Set Animation to | "CurrentAnimationName + X" and have it play that? And then "CurrentAnimationName - X" and again, play that?

    Double Edit: Or anyone know a plugin that can change specific colours to other colours and can be enabled and disabled?

  • I think in this case the easiest thing to do is just make a new animation of your sprites that are inverted

    And to aswer your Edit ? do exactly what you typed do set animation by name "Animation" +1 or -1 and set your animation names to Animation0 animation1 ect...

  • I think in this case the easiest thing to do is just make a new animation of your sprites that are inverted

    And to aswer your Edit ? do exactly what you typed do set animation by name "Animation" +1 or -1 and set your animation names to Animation0 animation1 ect...

    I mean like, Play Animation "X + Y" and have it play "XY", I tried using & and + but I can't make it connect the words to form just the one word so it selects the XY animation.

    Also, I got a new effect RGBrighter, but the best I can do with that is just make the sprite completely blue.

    The point of this is to have the enemy sprites change colour, exactly how they would in the Metroid games when shot with the ice beam. So far I've managed to get them to freeze and unfreeze and flash before unfreezing, I just need the colour change.

  • Try this, it uses a bit of text manipulation on the sprite.animationname value and should work with any numbered animation names. I suggest putting it into a function that, when called, will toggle the animation from Animation0 to Animation1 and back again.

    left(Sprite.AnimationName, len(Sprite.AnimationName) - 1) & ((int(mid(Sprite.AnimationName, len(Sprite.AnimationName) - 1, 1) ) + 1) % 2)[/code:2iym7kgv]
  • Try this, it uses a bit of text manipulation on the sprite.animationname value and should work with any numbered animation names. I suggest putting it into a function that, when called, will toggle the animation from Animation0 to Animation1 and back again.

    left(Sprite.AnimationName, len(Sprite.AnimationName) - 1) & ((int(mid(Sprite.AnimationName, len(Sprite.AnimationName) - 1, 1) ) + 1) % 2)[/code:3p6z1f72]
    

    Do I put this in an event or? Never used text before in that way. This is just for numbered animations, not animations with words?

  • If you label your animations "Animation0" and "Animation1" - any word followed by a zero or a one - then this code will change the animation from one to the other. See the attached - I hope this is clearer...!! I should have added above that you insert this code into the set animation event for a sprite.

  • Colludium

    You are a brilliant genius, thank you so much! You get a special thanks credit in my games credits

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • You can also use TokenAt() to pick a name.

    NumberToChangeTo=2

    Set Animation to tokenat("Default,AnimB,AnimC,AnimD",NumberToChangeTo,",")

    would set the animation to "AnimC"

  • You can also use TokenAt() to pick a name.

    NumberToChangeTo=2

    Set Animation to tokenat("Default,AnimB,AnimC,AnimD",NumberToChangeTo,",")

    would set the animation to "AnimC"

    Sorry but I can't really understand that, even though I've been using Construct 2 since June, I'm still pretty green.

  • TokenAt is just a list of strings, the number of the one you want to pull from the list, and the character used to separate the list.

    https://www.scirra.com/manual/126/system-expressions (scroll down to "Text" just over half way down the page.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)