# include <Siv3D.hpp> // OpenSiv3D v0.6.10
 
void Main()
{
	const int WINDOW_WIDTH = 800;
	const int WINDOW_HEIGHT = 600;
	const int P_RADIUS = 20;
	int BALL_SPEED = -1;
    //	p.x = p.x + BALL_SPEED;
 
	// 背景の色を設定する | Set the background color
	Scene::SetBackground(Color{ 135 , 206, 250 });
 
	Point p{ 400,300 };//座標を表すPoint型だよ
	while (System::Update())//多分60fps
	{
		Circle{ p, P_RADIUS }.draw(Color{255, 0, 0});
 
		Circle{ WINDOW_WIDTH/2, 150, P_RADIUS }.draw();
 
		Circle{ WINDOW_WIDTH/2, 450, P_RADIUS }.draw(Palette::Oldlace);
 
		Rect{ {10,10}, {100, 50} }.draw(Color{125,125, 0});
		//円は半径20ピクセルです。
		if (p.x <= WINDOW_WIDTH - P_RADIUS && p.x >= P_RADIUS)
		{
			p.x = p.x + BALL_SPEED;
			if (p.x == (WINDOW_WIDTH - P_RADIUS) || p.x == P_RADIUS)
				BALL_SPEED = -BALL_SPEED;
		}
 
		//円を1sに1pxだけx方向に移動
 
		//画面は800x600 幅800 高さ600
		//この円が、画面に出る前に、止めてあげて!
		//円のままとどまらせてあげてください
		Line{ {30,40},{200,100} }.draw(10, Palette::Orange);
		//往復運動やってみる
		//円が外周回るようにしてみて!
	}
}
  • game-engineer/classes/2023/game-programing-1/first-term/5/05-31-45.txt
  • 最終更新: 3年前
  • by root