LoginSignup
1
1

More than 1 year has passed since last update.

慣性付きの移動

Last updated at Posted at 2021-12-20

氷の上を滑るような慣性のついた移動を行うときには、移動距離が少しずつ変化するような実装を行います。

右(あるいは左)に移動するときには、すぐに座標を移動するのではなく、まず速度を少しずつ増やします。

image.png

何も移動されていなかったら、0になるまで少しずつ速度を落とします。

最後に、速度の分だけスプライトを移動します。

サンプルプログラム

スクリーンショット

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1