How do I make my character change color after damage?

0 favourites
  • 3 posts
From the Asset Store
Color Flow
$2 USD
60% off
Color all tiles with the same color in 22 moves or less!
  • I was wondering if it was possible to have my sprite flash red and flicker when it is hit without drawing extra frames in another program. And if so how?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First, give the sprite the Tint effect, default settings make it red. Then, at the start of the layout, disable the effect.

    Next, give the sprite the Flash behaviour.

    Now create a function that you'll call whenever the player is damaged. In that function, set the tint active, then start the flash behaviour, then wait a period of time, then set the tint inactive.

    I've attached a quick example of this in action.

    Note that this uses a WebGL effect, so this won't work if there's no WebGL support on your target platform. If you want to be absolutely rock-solid, then you might have to create new sprites with the red tint already applied. Flash will work regardless, though.

  • First, give the sprite the Tint effect, default settings make it red. Then, at the start of the layout, disable the effect.

    Next, give the sprite the Flash behaviour.

    Now create a function that you'll call whenever the player is damaged. In that function, set the tint active, then start the flash behaviour, then wait a period of time, then set the tint inactive.

    I've attached a quick example of this in action.

    Note that this uses a WebGL effect, so this won't work if there's no WebGL support on your target platform. If you want to be absolutely rock-solid, then you might have to create new sprites with the red tint already applied. Flash will work regardless, though.

    Thank you so much this is exactly what I was looking for. I'm updating my Windows Phone 8 app so I wont be able to use the red right now but once 8.1 is released then webgl shouldn't be an issue. You should add this to the tutorials on this site.

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