From 0e5a47b83a49bf0c2718851ed457fd051c3452ee Mon Sep 17 00:00:00 2001 From: Moonshrike Date: Mon, 15 Nov 2021 00:54:58 +0200 Subject: [PATCH] Revert "Revert "pushed"" This reverts commit 263490eb418d45297bb56fd31450496c7daefd4c. --- .../shooting/Hyperbola/Hyperbolic_Barrel.gd | 35 ++++++++++++++----- .../scripts/shooting/Line/Line_Barrel.gd | 18 ++++++++-- .../shooting/Parabola/Parabolic_Barrel.gd | 32 +++++++++++++---- .../scripts/shooting/Sine/Sine_Barrel.gd | 16 +++++++-- source/scenes/GUI/main_menu.tscn | 6 ++-- 5 files changed, 82 insertions(+), 25 deletions(-) diff --git a/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Barrel.gd b/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Barrel.gd index 4ee2205..3e27b8d 100644 --- a/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Barrel.gd +++ b/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Barrel.gd @@ -15,23 +15,40 @@ func _ready(): pos = Global.get("player").get_node('weaponHolder/Player-character-theme-gun').position -func _draw(): - update() - if pos.x > 0: - if dot_position.x < 1000: +#func _draw(): +# update() +# if pos.x > 0: +# if dot_position.x < 1000: +# velocity.x = 10 +# velocity.y = a_parameter/(time*b_parameter) +# dot_position += velocity * speed_hyper * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 +# if pos.x < 0: +# if dot_position.x < 1000: +# velocity.x = 10 +# velocity.y = -a_parameter/(time*b_parameter) +# dot_position += velocity * speed_hyper * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 + + +func trajectory(): + clear_points() + while dot_position.x < 1000: + if pos.x > 0: + add_point(dot_position) velocity.x = 10 velocity.y = a_parameter/(time*b_parameter) dot_position += velocity * speed_hyper * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) time += 0.06944 - if pos.x < 0: - if dot_position.x < 1000: + if pos.x < 0: + add_point(dot_position) velocity.x = 10 velocity.y = -a_parameter/(time*b_parameter) dot_position += velocity * speed_hyper * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) time += 0.06944 - func _process(_delta): + trajectory() update() diff --git a/source/assets/scripts/shooting/Line/Line_Barrel.gd b/source/assets/scripts/shooting/Line/Line_Barrel.gd index 35f9e74..fa78907 100644 --- a/source/assets/scripts/shooting/Line/Line_Barrel.gd +++ b/source/assets/scripts/shooting/Line/Line_Barrel.gd @@ -8,14 +8,26 @@ var time = 0 var a_parameter = 0 -func _draw(): - if dot_position.x < 1000: +#func _draw(): +# if dot_position.x < 1000: +# velocity.y = 10 * a_parameter +# velocity.x = 10 +# dot_position += velocity * speed * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 + + +func trajectory(): + clear_points() + while dot_position.x < 1000: + add_point(dot_position) velocity.y = 10 * a_parameter velocity.x = 10 dot_position += velocity * speed * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) time += 0.06944 + pass func _process(_delta): + trajectory() update() diff --git a/source/assets/scripts/shooting/Parabola/Parabolic_Barrel.gd b/source/assets/scripts/shooting/Parabola/Parabolic_Barrel.gd index 8097f78..c18708b 100644 --- a/source/assets/scripts/shooting/Parabola/Parabolic_Barrel.gd +++ b/source/assets/scripts/shooting/Parabola/Parabolic_Barrel.gd @@ -12,23 +12,41 @@ var pos func _ready(): pos = Global.get("player").get_node('weaponHolder/Player-character-theme-gun').position -func _draw(): - if pos.x > 0: - if dot_position.x < 1000: +#func _draw(): +# if pos.x > 0: +# if dot_position.x < 1000: +# velocity.y = time*(a_parameter * time + b_parameter) +# velocity.x = 5 +# dot_position += velocity * speed_parab * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 +# if pos.x < 0: +# if dot_position.x < 1000: +# velocity.y = -time*(a_parameter * time + b_parameter) +# velocity.x = 5 +# dot_position += velocity * speed_parab * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 +# + +func trajectory(): + clear_points() + while dot_position.x < 1000: + if pos.x > 0: + add_point(dot_position) velocity.y = time*(a_parameter * time + b_parameter) velocity.x = 5 dot_position += velocity * speed_parab * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) time += 0.06944 - if pos.x < 0: - if dot_position.x < 1000: + if pos.x < 0: + add_point(dot_position) velocity.y = -time*(a_parameter * time + b_parameter) velocity.x = 5 dot_position += velocity * speed_parab * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) time += 0.06944 func _process(_delta): + trajectory() update() diff --git a/source/assets/scripts/shooting/Sine/Sine_Barrel.gd b/source/assets/scripts/shooting/Sine/Sine_Barrel.gd index f093b70..ecf104a 100644 --- a/source/assets/scripts/shooting/Sine/Sine_Barrel.gd +++ b/source/assets/scripts/shooting/Sine/Sine_Barrel.gd @@ -10,13 +10,23 @@ export var amplitude = 4 export var frequency = 5 -func _draw(): - if dot_position.x < 1000: +#func _draw(): +# if dot_position.x < 1000: +# velocity.y = amplitude * cos(time * frequency) +# velocity.x = 5 +# dot_position += velocity * speed * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 + +func trajectory(): + clear_points() + while dot_position.x < 1000: + add_point(dot_position) velocity.y = amplitude * cos(time * frequency) velocity.x = 5 dot_position += velocity * speed * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) time += 0.06944 func _process(_delta): + trajectory() update() diff --git a/source/scenes/GUI/main_menu.tscn b/source/scenes/GUI/main_menu.tscn index 308c53f..c298a45 100644 --- a/source/scenes/GUI/main_menu.tscn +++ b/source/scenes/GUI/main_menu.tscn @@ -54,8 +54,8 @@ margin_left = -150.0 margin_top = -36.0 margin_right = 150.0 margin_bottom = 36.0 -custom_fonts/font = ExtResource( 5 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = ExtResource( 5 ) text = "PLAY" align = 1 valign = 1 @@ -79,8 +79,8 @@ margin_left = -98.8223 margin_top = -36.0 margin_right = 134.178 margin_bottom = 36.0 -custom_fonts/font = ExtResource( 5 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = ExtResource( 5 ) text = "LAN Party" align = 1 valign = 1 @@ -111,8 +111,8 @@ margin_left = -150.0 margin_top = -36.0 margin_right = 150.0 margin_bottom = 36.0 -custom_fonts/font = ExtResource( 5 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = ExtResource( 5 ) text = "EXIT" align = 1 valign = 1