Issues with hit effect display

在使用AGM制作横版动作游戏时,遇到一个难题,就是主角在攻击敌人时,敌人身上会出现击中特效。我原计划在敌人脚本里面设置的是anystate-条件:受到攻击-执行:显示特效,返回anystate。但有个问题就是一旦出现特效,敌人的攻击就被打断,敌人攻击动画就从头开始,这样主角就可以一直攻击不会被反击。我想的是:敌人攻击时,就算被击中,产生击中特效,也不会打断敌人攻击,相当于霸体。这种怎么设置?

There are several approaches, but I think the most flexible one is to create another object as a child node.

For example, you could handle the attack logic in the parent node and process the damage effects in the child node object.

Hello, I’d like to know the specific steps. Could you please provide more details? Do you mean creating a new game object under the enemy node? If so, how should this game object be configured? Please provide detailed instructions. Thank you!

There are two methods for this.

The first is to place a GameObject inside another GameObject, just as you would place one inside a Scene.
image

The second method is to generate the target object as a child object using the “Instantiate Object” action. When using this method, set “ChildSettings” on the side that will become the child object, and specify “Follow without moving away from the parent object” as the movement method.

In either case, if colliders interfere with each other, the objects will repel one another. Therefore, we recommend using an Area2D GameObject that does not interfere.

Then, on the child object side, you can configure it to display a hit effect when it registers a hit. This child object can also be used when you want to perform certain actions on the child object without interrupting the processing on the parent object side.

I’ve implemented the hit effect feature using the method you suggested. Thank you. However, a new issue has arisen: when performing consecutive attacks, the game has a chance of crashing after multiple hit effects appear. Even the death effect I set for enemies has a chance of causing a crash during playback. Since the crashes are probabilistic, it probably isn’t an event logic issue, and there are no error messages. I’m unsure of the cause.

There might be an issue with displaying the effects. If possible, could you please send the project to pgmmv-support@gotchagotcha.jp?

Hi, I’ve already sent the project files to you via email. If you press ‘C’ to attack an enemy, you may find that the game crashes.

Thank you for sharing the project!
It’s a cool game, but unfortunately, I couldn’t reproduce the issue. It might be influenced by the environment to some extent.

However, after carefully reviewing the code for the action that displays the effect, I identified a section where the issue could potentially occur.
I’ll let you know once I’ve made a fix. In the meantime, please test whether the issue occurs on your end.

Also, I noticed that the renderer is set to compatibility mode. It might be worth trying Forward+ rendering, as that could potentially resolve the issue.

Yes, I tested it on another computer and haven’t found any crash issues so far. I’ve put this aside for now and continued with development. Thanks for your help!

We have released a version today with fixes to the potentially affected areas regarding this issue. Please check it out: