Skip to content

Commit

Permalink
add fullscreen mode, fix effect
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Piepkorn committed Oct 2, 2022
1 parent 1b4c53f commit a6adadd
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
9 changes: 6 additions & 3 deletions game.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,14 @@ stream = ExtResource("7_5w6gj")

[node name="UI" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_right = 1152.0
offset_bottom = 648.0
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

[node name="FPSCounter" type="Label" parent="UI"]
visible = false
offset_right = 40.0
offset_bottom = 23.0
script = ExtResource("4_r6i1x")
Expand Down
3 changes: 0 additions & 3 deletions scenes/menu/death.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ grow_vertical = 2
script = ExtResource("1_bh7aj")

[node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
Expand All @@ -23,7 +22,6 @@ texture = ExtResource("1_ltxh5")
ignore_texture_size = true

[node name="RichTextLabel" type="RichTextLabel" parent="TextureRect"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
Expand All @@ -45,7 +43,6 @@ Unknown sensor echoes have been detected approaching earth.
[/center]"

[node name="TryAgainButton" type="Button" parent="TextureRect"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
Expand Down
7 changes: 6 additions & 1 deletion scenes/menu/welcome.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func _ready():
pass # Replace with function body.

func _input(event):
if event.is_action_pressed("fire") || event.is_action_pressed("ui_select"):
if event.is_action_pressed("ui_select"):
_on_start_button_pressed()

# Called every frame. 'delta' is the elapsed time since the previous frame.
Expand All @@ -22,3 +22,8 @@ func _process(delta):

func _on_start_button_pressed():
get_tree().change_scene_to_packed(gameScene)


func _on_start_button_fs_pressed():
get_viewport().mode = Window.MODE_FULLSCREEN
get_tree().change_scene_to_packed(gameScene)
28 changes: 24 additions & 4 deletions scenes/menu/welcome.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ grow_vertical = 2
script = ExtResource("1_ltn21")

[node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
Expand All @@ -22,6 +23,7 @@ texture = ExtResource("1_f2ka8")
ignore_texture_size = true

[node name="RichTextLabel" type="RichTextLabel" parent="TextureRect"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
Expand All @@ -44,18 +46,36 @@ Take any action necessary to prevent an alien incursion.[/color][/font_size]
[/center]"

[node name="StartButton" type="Button" parent="TextureRect"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -141.0
offset_top = -128.0
offset_right = 141.0
offset_bottom = -79.0
offset_left = -404.0
offset_top = -118.0
offset_right = -90.0
offset_bottom = -69.0
grow_horizontal = 2
grow_vertical = 0
theme_override_font_sizes/font_size = 24
text = "Start Mission"

[node name="StartButtonFS" type="Button" parent="TextureRect"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = 69.0
offset_top = -118.0
offset_right = 379.0
offset_bottom = -69.0
grow_horizontal = 2
grow_vertical = 0
theme_override_font_sizes/font_size = 24
text = "Start Mission (Fullscreen)"

[connection signal="pressed" from="TextureRect/StartButton" to="." method="_on_start_button_pressed"]
[connection signal="pressed" from="TextureRect/StartButtonFS" to="." method="_on_start_button_fs_pressed"]
3 changes: 2 additions & 1 deletion scripts/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ func _physics_process(delta):
apply_central_force(global_transform.basis * Vector3(movement.x * THRUST_SIDE, upDown * THRUST_SIDE, -THRUST_FORWARD*movement.y if movement.y > 0 else THRUST_BACK*movement.y))
if Input.get_connected_joypads().size() > 0:
var steer = Input.get_vector("steer_left", "steer_right", "steer_up", "steer_down")
constant_torque = global_transform.basis * Vector3(-steer.y * CONTROLLER_SENSITIVITY, -steer.x * CONTROLLER_SENSITIVITY, 0)
if abs(steer.x) >= 0.01 || abs(steer.y) >= 0.01:
constant_torque = global_transform.basis * Vector3(-steer.y * CONTROLLER_SENSITIVITY, -steer.x * CONTROLLER_SENSITIVITY, 0)

#func _integrate_forces(state):
# var localAngular = angular_velocity * global_transform.basis
Expand Down

0 comments on commit a6adadd

Please sign in to comment.