#include <Siv3D.hpp>
typedef struct
{
int x, y, flag,f;
float prd;
float mvsp;
}Mario;
void Main()
{
const Texture img(L"image/ball.png");
const int H = 1280;
const int W = 720;
const int F = 20;
const int MotionSpeed = 2;
double ForSin = 0.01;
const Font font(30);
Window::Resize(H, W);
Mario mario;
mario.y = 0;
mario.x = 720/2;
mario.prd = 0;
mario.flag = 1;
mario.f = 0;
mario.mvsp = 0;
while (System::Update())
{
if (Input::KeyX.clicked)
{
mario.flag = 1;
mario.f = F;
}
if (Input::KeyX.pressed && mario.flag == 1 && mario.prd < F*1.25)
{
ForSin -= 0.0125;
mario.prd -=MotionSpeed*ForSin;
}
if (mario.flag == 1) mario.prd+=MotionSpeed;
if (mario.y > W - 64)
{
ForSin = 1;
mario.f = 0;
mario.prd = 0;
mario.flag = 0;
mario.y = W - 64;
}
mario.y = mario.y - (mario.f - mario.prd);
if (Input::KeyZ.pressed)
{
mario.mvsp++;
if (mario.flag)
{
mario.mvsp -= 0.5;
}
}
if (Input::KeyC.pressed)
{
mario.mvsp--;
if (mario.flag)
{
mario.mvsp += 0.5;
}
}
if (mario.flag == 0)
{
if (mario.mvsp < 0 && mario.flag == 0) mario.mvsp += 0.5;
if (0 < mario.mvsp && mario.flag == 0) mario.mvsp -= 0.5;
}
mario.x = mario.x - mario.mvsp;
img.draw(int(mario.x),int(mario.y));
font(mario.y).draw(256,0);
font(mario.prd).draw(256,36);
font(mario.f).draw(256,72);
font(mario.flag).draw(256,108);
font(L"PosY:").draw(0, 0);
font(L"JumpPow:").draw(0, 36);
font(L"PJumpPow:").draw(0, 72);
font(L"onAir?:").draw(0, 108);
}
}
I2luY2x1ZGUgPFNpdjNELmhwcD4KCnR5cGVkZWYgc3RydWN0CnsKCWludCB4LCB5LCBmbGFnLGY7CglmbG9hdCBwcmQ7CglmbG9hdCBtdnNwOwp9TWFyaW87Cgp2b2lkIE1haW4oKQp7Cgljb25zdCBUZXh0dXJlIGltZyhMImltYWdlL2JhbGwucG5nIik7Cgljb25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