Jump to content

Enemy hit effect


sunDalik
 Share

Recommended Posts

I'm making a game with Pixi.js and I want to implement a hit effect: whenever you hit an enemy a semi-transparent red layer of the enemy's sprite shape will cover him for a second. I guess an example will explain it better, so I attached an image ? 

The question is what are the ways to implement it? I can't come up with any.

hit_problem.png

Link to comment
Share on other sites

The question is what are the ways to implement it? I can't come up with any.

It looks like our "examples" page is not visible enough in the web.

0. ColorMatrixFilter, but its a filter, it uses extra framebuffer and it can be slow for many objects. https://pixijs.io/examples/#/filters-basic/color-matrix.js

Cheap solutions:

1. "tint" parameter:https://pixijs.io/examples/#/demos-basic/tinting.js

2. you can use https://github.com/gameofbombs/pixi-heaven1 plugin to tint both black and white https://pixijs.io/examples/#/plugin-heaven/invert.js

Welcome to the forums!

Link to comment
Share on other sites

10 minutes ago, ivan.popelyshev said:

The question is what are the ways to implement it? I can't come up with any.

It looks like our "examples" page is not visible enough in the web.

0. ColorMatrixFilter, but its a filter, it uses extra framebuffer and it can be slow for many objects. https://pixijs.io/examples/#/filters-basic/color-matrix.js

Cheap solutions:

1. "tint" parameter:https://pixijs.io/examples/#/demos-basic/tinting.js

2. you can use https://github.com/gameofbombs/pixi-heaven1 plugin to tint both black and white https://pixijs.io/examples/#/plugin-heaven/invert.js

Welcome to the forums!

Oh wow thanks! Looks like exactly what I need. Gonna bookmark that examples page...

Edited by sunDalik
Link to comment
Share on other sites

Also bookmark wiki , here's one of the pages: https://github.com/pixijs/pixi.js/wiki/v5-Hacks

And the best document is the source code, if you are proficient with IDEs (vscode, intellij idea/webstorms), just clone this thing and open in separate window to search classes faster: https://github.com/pixijs/pixi.js . There are many places in PixiJS that are very stupid and easy to hack if you see that you need different behaviour.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...