シーンを揺らすというアクションはありますが、キャラクター一個単位で揺らすことはできますか?
No current official way to shake individual characters. I could make a script for you to use InvokeScript to shake a Sprite/AnimatedSprite if you would be ok with that?
Would it be okay if I try asking you?
Sure—no problem! I’m on holiday right now, but I’ll try to make this for you when I’m back.
Try this script:
baz_shake_node.gd (3.5 KB)
To use:
- Add script to project
- Create a Node2D on the game object you want to shake and add script to it
- Set the object you want to shake. I recommend the Sprite2D or AnimatedSprite2D. If you for some reason it messes with your AnimationPlayer then you can make a Node2D as the parent of the sprite and shake that
- Set the rest of the settings
- Use InvokeScript to call the function from inside the visual script
横からですが、使用させていただきました。
baz_shake_node.gdの動画での組み込み方、大変分かりやすかったです。
ワタシが「やりたい動き」なのですが
①大型のボス敵が大振りのパンチモーションを行う
②その間、主人公は各種攻撃をボスに仕掛ける
③ボスのパンチモーションはキャンセルされず、攻撃を受けた時に「shake」と「色変更」を行う
俗にいう「ハイパーアーマー」を表現したいのですが
baz_shake_node.gdが自身のアニメへの命令指定しかなく、VSで設定ができませんでした。
「ボスダメージ管理オブジェクト」を追加で作成し、
≪ボスのHPが減った≫→≪ボス(親)をshake & 色変更する≫仕組みが対応できればと思いますが
何か方法はありますでしょうか?
Making sure I understand correctly, you are trying for something like this?
I think this is the desire you were wanting @zo-nomori:
New version of the shake node that has ‘target via name’ option:
baz_shake_node.gd (6.2 KB)
- I setup the attack, only notable thing was using a Node2D for the animation movement. Also make sure the Node2D has ‘use parent material’ selected so filters work on the sprite:
- I setup a bound object that was a child:
- I setup the hyper armor child with a visual script to detect the parents hp change and then invoke the new shake node settings using the ‘via name’ option:
- Quick reference of the shake node settings:
ありがとう!
設定で上手くいかず、DMにてデータを送ります。
My reply is a bit late, but it worked perfectly. Thank you very much!

