キャラクターを揺らしたい

シーンを揺らすというアクションはありますが、キャラクター一個単位で揺らすことはできますか?

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.

1 Like

Try this script:
baz_shake_node.gd (3.5 KB)

To use:

  1. Add script to project
  2. Create a Node2D on the game object you want to shake and add script to it
  3. 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
  4. Set the rest of the settings
  5. Use InvokeScript to call the function from inside the visual script

1 Like

横からですが、使用させていただきました。
baz_shake_node.gdの動画での組み込み方、大変分かりやすかったです。

ワタシが「やりたい動き」なのですが
①大型のボス敵が大振りのパンチモーションを行う
②その間、主人公は各種攻撃をボスに仕掛ける
③ボスのパンチモーションはキャンセルされず、攻撃を受けた時に「shake」と「色変更」を行う

俗にいう「ハイパーアーマー」を表現したいのですが
baz_shake_node.gdが自身のアニメへの命令指定しかなく、VSで設定ができませんでした。

「ボスダメージ管理オブジェクト」を追加で作成し、
≪ボスのHPが減った≫→≪ボス(親)をshake & 色変更する≫仕組みが対応できればと思いますが
何か方法はありますでしょうか?

Making sure I understand correctly, you are trying for something like this?

1 Like

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)

  1. 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:

  1. I setup a bound object that was a child:

  1. 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:

  1. Quick reference of the shake node settings:

1 Like

ありがとう!

設定で上手くいかず、DMにてデータを送ります。

1 Like

My reply is a bit late, but it worked perfectly. Thank you very much!

1 Like