質問編集履歴
3
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
放物線
|
1
|
+
放物線いどうaaaa
|
test
CHANGED
File without changes
|
2
ミスコード
test
CHANGED
File without changes
|
test
CHANGED
@@ -3,111 +3,3 @@
|
|
3
3
|
何度も試行錯誤しましたができませんでした。
|
4
4
|
|
5
5
|
解決策を教えてください。
|
6
|
-
|
7
|
-
public partial class FormBallshoot : Form
|
8
|
-
|
9
|
-
{
|
10
|
-
|
11
|
-
double ballPos_x;
|
12
|
-
|
13
|
-
double ballPos_y;
|
14
|
-
|
15
|
-
double ballSpeed_x;
|
16
|
-
|
17
|
-
double ballSpeed_y;
|
18
|
-
|
19
|
-
int ballRadius;
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
public FormBallshoot()
|
26
|
-
|
27
|
-
{
|
28
|
-
|
29
|
-
double v = 10;
|
30
|
-
|
31
|
-
double deg = 30;
|
32
|
-
|
33
|
-
double g = 9.8;
|
34
|
-
|
35
|
-
double t = 1;
|
36
|
-
|
37
|
-
t++;
|
38
|
-
|
39
|
-
InitializeComponent();
|
40
|
-
|
41
|
-
this.ballPos_x = 10;
|
42
|
-
|
43
|
-
this.ballPos_y = 600;
|
44
|
-
|
45
|
-
this.ballSpeed_x = v * t * Math.Cos(deg * Math.PI / 180);
|
46
|
-
|
47
|
-
this.ballSpeed_y = v * t * Math.Sin(deg * Math.PI / 180) - 0.5 * g * t * t;
|
48
|
-
|
49
|
-
//this.ballSpeed = new Vector(5, -5);
|
50
|
-
|
51
|
-
this.ballRadius = 10;
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
Timer timer = new Timer();
|
56
|
-
|
57
|
-
timer.Interval = 30;
|
58
|
-
|
59
|
-
timer.Tick += new EventHandler(Update);
|
60
|
-
|
61
|
-
timer.Start();
|
62
|
-
|
63
|
-
}
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
private void Update(object sender, EventArgs e)
|
68
|
-
|
69
|
-
{
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
ballPos_x += ballSpeed_x;
|
74
|
-
|
75
|
-
ballPos_y += ballSpeed_y;
|
76
|
-
|
77
|
-
Invalidate();
|
78
|
-
|
79
|
-
}
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
private void endToolStripMenuItem_Click(object sender, EventArgs e)
|
86
|
-
|
87
|
-
{
|
88
|
-
|
89
|
-
Close();
|
90
|
-
|
91
|
-
}
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
private void Draw_Figuare(object sender, PaintEventArgs e)
|
96
|
-
|
97
|
-
{
|
98
|
-
|
99
|
-
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
100
|
-
|
101
|
-
//円を描画する
|
102
|
-
|
103
|
-
SolidBrush brush = new SolidBrush(Color.Red);
|
104
|
-
|
105
|
-
float px = (float)this.ballPos_x - this.ballRadius;
|
106
|
-
|
107
|
-
float py = (float)this.ballPos_y - this.ballRadius;
|
108
|
-
|
109
|
-
e.Graphics.FillEllipse(brush, px, py, this.ballRadius * 2, this.ballRadius * 2);
|
110
|
-
|
111
|
-
}
|
112
|
-
|
113
|
-
}
|
1
y方向の式
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
this.ballSpeed_x = v * t * Math.Cos(deg * Math.PI / 180);
|
46
46
|
|
47
|
-
this.ballSpeed_y =
|
47
|
+
this.ballSpeed_y = v * t * Math.Sin(deg * Math.PI / 180) - 0.5 * g * t * t;
|
48
48
|
|
49
49
|
//this.ballSpeed = new Vector(5, -5);
|
50
50
|
|