moonwalker

This commit is contained in:
Page Asgardius 2024-01-20 06:58:29 -07:00
parent d3eef9dbac
commit 9dda46397e
12 changed files with 160 additions and 8 deletions

View file

@ -43,10 +43,27 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
Global.xm = 0
Global.ym = 0
var velocity = Vector2.ZERO
if Global.live == 1:
if Input.get_joy_axis(0,JOY_AXIS_LEFT_X) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_X) < -0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) < -0.2:
Global.xm = Input.get_joy_axis(0,JOY_AXIS_LEFT_X)
Global.ym = Input.get_joy_axis(0,JOY_AXIS_LEFT_Y)
else:
if Input.is_action_pressed("ui_left"):
Global.xm = -1
if Input.is_action_pressed("ui_right"):
Global.xm = 1
if Input.is_action_pressed("ui_up"):
Global.ym = -1
if Input.is_action_pressed("ui_down"):
Global.ym = 1
velocity = (Vector2.RIGHT.rotated(rotation) * -100 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -100 * Global.ym * delta
func _input(event):
if Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK):
Global.live = 0
get_tree().root.remove_child(player)
get_tree().root.remove_child(level)
if Global.debug:

View file

@ -60,3 +60,8 @@ func _on_game_over_pressed():
func _on_gauge_fill_pressed():
player.stream = load(Global.sfxtracks[1])
player.play(0)
func _on_explosion_pressed():
player.stream = load(Global.sfxtracks[2])
player.play(0)

View file

@ -77,11 +77,11 @@ text = "Gauge Fill"
[node name="VBoxContainer2" type="VBoxContainer" parent="BoxContainer"]
layout_mode = 2
[node name="Placeholder 2" type="Button" parent="BoxContainer/VBoxContainer2"]
[node name="Explosion" type="Button" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
theme_override_font_sizes/font_size = 25
theme_override_styles/focus = SubResource("StyleBoxFlat_cprm3")
text = "Placeholder 2"
text = "Explosion"
[node name="Back" type="Button" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
@ -95,3 +95,5 @@ layout_mode = 1
[connection signal="finished" from="nebula" to="nebula" method="_on_finished"]
[connection signal="pressed" from="BoxContainer/VBoxContainer/Game Over" to="." method="_on_game_over_pressed"]
[connection signal="pressed" from="BoxContainer/VBoxContainer/Gauge Fill" to="." method="_on_gauge_fill_pressed"]
[connection signal="pressed" from="BoxContainer/VBoxContainer2/Explosion" to="." method="_on_explosion_pressed"]
[connection signal="pressed" from="BoxContainer/VBoxContainer2/Back" to="." method="_on_back_pressed"]

View file

@ -48,9 +48,11 @@ func _on_back_pressed():
func _on_testspawn_pressed():
Global.dplace = [0, 2, 1]
Global.live = 1
get_tree().change_scene_to_file("res://levels/ui/gameplay.tscn")
func _on_testboss_pressed():
Global.dplace = [0, 1, 1]
Global.live = 1
get_tree().change_scene_to_file("res://levels/ui/gameplay.tscn")