Skip to content

Commit 3b6fd84

Browse files
committed
switched from M_PI to Math_PI to fix #9
1 parent 0918368 commit 3b6fd84

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

bullet.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ void Bullet::_update_offset(){
3939
position -= _offset;
4040
Vector2 h_offset;
4141
Vector2 v_offset;
42-
Vector2 perpendicular = direction.rotated(M_PI_2);
42+
Vector2 perpendicular = direction.rotated(Math_PI / 2);
4343

4444
switch (type->get_h_wave_type()){
4545
case BulletType::WaveType::SIN:
46-
h_offset = direction * type->get_h_wave_amplitude() * sin(time * 2 * M_PI * type->get_h_wave_frequency());
46+
h_offset = direction * type->get_h_wave_amplitude() * sin(time * 2 * Math_PI * type->get_h_wave_frequency());
4747
break;
4848

4949
case BulletType::WaveType::COS:
50-
h_offset = direction * type->get_h_wave_amplitude() * (cos(time * 2 * M_PI * type->get_h_wave_frequency()) - 1);
50+
h_offset = direction * type->get_h_wave_amplitude() * (cos(time * 2 * Math_PI * type->get_h_wave_frequency()) - 1);
5151
break;
5252

5353
default:
@@ -57,11 +57,11 @@ void Bullet::_update_offset(){
5757

5858
switch (type->get_v_wave_type()){
5959
case BulletType::WaveType::SIN:
60-
v_offset = perpendicular * type->get_v_wave_amplitude() * sin(time * 2 * M_PI * type->get_v_wave_frequency());
60+
v_offset = perpendicular * type->get_v_wave_amplitude() * sin(time * 2 * Math_PI * type->get_v_wave_frequency());
6161
break;
6262

6363
case BulletType::WaveType::COS:
64-
v_offset = perpendicular * type->get_v_wave_amplitude() * (cos(time * 2 * M_PI * type->get_v_wave_frequency()) - 1);
64+
v_offset = perpendicular * type->get_v_wave_amplitude() * (cos(time * 2 * Math_PI * type->get_v_wave_frequency()) - 1);
6565
break;
6666

6767
default:

bullet_spawner.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ Array BulletSpawner::_create_volley() const {
165165
bool spacing_maxed = false;
166166

167167
float volley_start = -arc_extent;
168-
if (spacing > 2 * M_PI / shot_count){
169-
spacing = 2 * M_PI / shot_count;
170-
volley_start = -M_PI + spacing / 2;
168+
if (spacing > 2 * Math_PI / shot_count){
169+
spacing = 2 * Math_PI / shot_count;
170+
volley_start = -Math_PI + spacing / 2;
171171
spacing_maxed = true;
172172
}
173173

@@ -178,7 +178,7 @@ Array BulletSpawner::_create_volley() const {
178178
}
179179
shot_angle += volley_start;
180180
Vector2 shot_normal = Vector2(1,0).rotated(shot_angle);
181-
if (arc_width >= 2 * M_PI || Math::abs(shot_normal.angle()) <= arc_extent + 0.001){
181+
if (arc_width >= 2 * Math_PI || Math::abs(shot_normal.angle()) <= arc_extent + 0.001){
182182
Dictionary shot;
183183
shot_normal = shot_normal.rotated(arc_rotation);
184184
shot["normal"] = shot_normal;
@@ -494,7 +494,7 @@ void BulletSpawner::_draw_preview(const Color &p_border_col, const Color &p_shot
494494
inner_points.set(i, inner_point);
495495
outer_points.set(i, outer_point);
496496
}
497-
if (arc_width < 2* M_PI){
497+
if (arc_width < 2* Math_PI){
498498
outer_points.insert(0, inner_points[0]);
499499
outer_points.push_back(inner_points[inner_points.size() - 1]);
500500
draw_polyline(inner_points, p_border_col);

0 commit comments

Comments
 (0)