Fixed Bugs; Added Mobile Support

This commit is contained in:
Exobyt 2024-08-20 12:17:01 +02:00
parent 956b719e62
commit fdfb6a7d39
35 changed files with 709 additions and 150 deletions

47
scenes/Main/control.gd Normal file
View file

@ -0,0 +1,47 @@
extends Control
@onready var buttonContainer1 = $HBoxContainer3
@onready var buttonContainer2 = $HBoxContainer4
@onready var buttonContainer3 = $HBoxContainer5
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
print(DisplayServer.mouse_get_position() != Vector2i())
if DisplayServer.mouse_get_position() == Vector2i():
buttonContainer1.show()
buttonContainer2.show()
buttonContainer3.show()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_left_button_pressed() -> void:
Input.action_press("left")
Input.action_release("left")
func _on_right_button_pressed() -> void:
Input.action_press("right")
Input.action_release("right")
func _on_rotate_left_button_pressed() -> void:
Input.action_press("rotate_left")
Input.action_release("rotate_left")
func _on_rotate_right_button_pressed() -> void:
Input.action_press("rotate_right")
Input.action_release("rotate_right")
func _on_down_button_button_down() -> void:
Input.action_press("down")
func _on_down_button_button_up() -> void:
Input.action_press("down")
Input.action_release("down")

View file

@ -1,17 +1,5 @@
extends Node
@onready var gameTimer = $GameTimer
@onready var scoreLabel = $Camera2D/CanvasLayer/Control/HBoxContainer/ScoreValue
@onready var timeLabel = $Camera2D/CanvasLayer/Control/HBoxContainer2/TimeValue
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func _physics_process(delta: float) -> void:
scoreLabel.text = str(GLOBAL.points)
timeLabel.text = str(GLOBAL.time)
func _on_game_timer_timeout() -> void:
GLOBAL.time += 1
gameTimer.start(1)

View file

@ -1,10 +1,8 @@
[gd_scene load_steps=6 format=3 uid="uid://bq5hrqgv0f6hp"]
[gd_scene load_steps=4 format=3 uid="uid://bq5hrqgv0f6hp"]
[ext_resource type="PackedScene" uid="uid://dwl4lotl1d3ij" path="res://scenes/Grid/grid.tscn" id="1_88eap"]
[ext_resource type="Script" path="res://scenes/Main/main.gd" id="1_dtde6"]
[ext_resource type="PackedScene" uid="uid://c03h0nwewolfx" path="res://scenes/Grid/SpeedScale.tscn" id="2_mnoeo"]
[ext_resource type="LabelSettings" uid="uid://cd783ubpcytc8" path="res://Theme/label.tres" id="3_jopb4"]
[ext_resource type="Script" path="res://scenes/Main/score_value.gd" id="3_vtvng"]
[node name="main" type="Node"]
script = ExtResource("1_dtde6")
@ -15,66 +13,3 @@ position = Vector2(128, 256)
[node name="Node2D" parent="." instance=ExtResource("2_mnoeo")]
visible = false
position = Vector2(960, 896)
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(448, 896)
[node name="CanvasLayer" type="CanvasLayer" parent="Camera2D"]
[node name="Control" type="Control" parent="Camera2D/CanvasLayer"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="HBoxContainer" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control"]
layout_mode = 1
offset_left = 56.0
offset_top = 64.0
offset_right = 320.0
offset_bottom = 152.0
[node name="Score" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer"]
layout_mode = 2
text = "Score: "
label_settings = ExtResource("3_jopb4")
horizontal_alignment = 1
vertical_alignment = 1
[node name="ScoreValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer"]
layout_mode = 2
label_settings = ExtResource("3_jopb4")
horizontal_alignment = 1
script = ExtResource("3_vtvng")
[node name="HBoxContainer2" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control"]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -312.0
offset_top = 64.0
offset_right = -56.0
offset_bottom = 152.0
grow_horizontal = 0
alignment = 2
[node name="TimeValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer2"]
layout_mode = 2
label_settings = ExtResource("3_jopb4")
horizontal_alignment = 1
vertical_alignment = 1
[node name="Time" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer2"]
layout_mode = 2
text = " :Time"
label_settings = ExtResource("3_jopb4")
horizontal_alignment = 1
vertical_alignment = 1
[node name="GameTimer" type="Timer" parent="."]
autostart = true
[connection signal="timeout" from="GameTimer" to="." method="_on_game_timer_timeout"]