Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LoadDragon0000000000/e0d18b164468fe31124a2100eb84c1e8 to your computer and use it in GitHub Desktop.
Save LoadDragon0000000000/e0d18b164468fe31124a2100eb84c1e8 to your computer and use it in GitHub Desktop.
#include "DxLib.h"
#include <math.h>
const float DEGTORAD = 0.017453293f; // 度数表記をラジアンに変換する定数
int WINAPI WinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int) {
// ---ここから設定---
ChangeWindowMode(TRUE), SetMainWindowText("きれいなジャンプ"), SetGraphMode(640, 480, 32),
SetDoubleStartValidFlag(TRUE); DxLib_Init(), SetDrawScreen(DX_SCREEN_BACK);
// ---ここまで設定---
float PlayerY = 320.0f;
float JumpCount = 80; // ボタンが押された長さ(ここでは仮に80とする)
int JumpTimer = 0;
// ゲームループ
while (ScreenFlip() == 0 && ProcessMessage() == 0 && ClearDrawScreen() == 0) {
++JumpTimer;
PlayerY -= (20 + JumpCount + (-0.3270f) * (JumpTimer)) / 60;
DrawCircle(320, PlayerY, 30, GetColor(255, 0, 0), true);
}
DxLib_End(); return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment