0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

メモ テーブルでジャンプを設定する

Posted at

ジャンプの設定
テーブルを使ったジャンプ
あらかじめジャンプ量をテーブルで設定しておく
unityで使う際はlerpを使ってなめやらかにするのがよいと思う。
float x,y;//座標
int phase;//テーブル選択管理
int
Jump_table[]={15,13,10,10,8,7,6,6,4,2,1,1,1,1,0,0,0,0,0,-1,-1,-1,-1,-2,-4,-6,-6,-16,-20,-28,-10000};

//ジャンプ
float jumpY = 0;
if (mode == 0)
{//ジャンプしていない
if (SPACE)//スペース押した
{
phase = 0;//フェーズ初期化
mode = 1;
}
}
else
{
jumpY = Jump_table[phase];//ジャンプ移動量
y -= jumpY;//ジャンプ
phase++;//フェーズを次へ
if (Jump_table[phase] < -1000) //ありえないほどマイナスになったら終了
{
phase = 0;
mode = 0;
}

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?