Added introductory touchscreen support for mobile devices.
This commit is contained in:
parent
df13ee42d8
commit
4c512379c5
34 changed files with 697 additions and 1 deletions
|
|
@ -84,6 +84,7 @@ func _on_shoot_timer_timeout():
|
|||
else:
|
||||
$ShootTimer.start()
|
||||
|
||||
|
||||
func _process(delta):
|
||||
|
||||
if stunned == true:
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ const ROWS: int = 3
|
|||
|
||||
@onready var start_button = $CanvasLayer/CenterContainer/Start
|
||||
@onready var game_over = $CanvasLayer/CenterContainer/GameOver
|
||||
@onready var virtual_controls = $CanvasLayer/VirtualControls
|
||||
|
||||
func _ready():
|
||||
game_over.hide()
|
||||
|
|
@ -29,6 +30,7 @@ func _ready():
|
|||
EventBus.flash_screen.connect(_on_flash_screen)
|
||||
EventBus.win_game.connect(_on_win_game)
|
||||
EventBus.secret_win_game.connect(_on_secret_win_game)
|
||||
virtual_controls.hide()
|
||||
|
||||
|
||||
#func spawn_enemies():
|
||||
|
|
@ -139,6 +141,12 @@ func new_game():
|
|||
|
||||
|
||||
func _input(EventInput):
|
||||
|
||||
if EventInput is InputEventScreenTouch:
|
||||
if EventInput.pressed:
|
||||
virtual_controls.show()
|
||||
|
||||
|
||||
if EventInput.is_action_pressed("shoot") and playing == false:
|
||||
print("Input detected!")
|
||||
start_button.hide()
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
[ext_resource type="Script" uid="uid://c51huloycn5as" path="res://scenes/main.gd" id="1_h2yge"]
|
||||
[ext_resource type="PackedScene" uid="uid://tlcdxoupi2lb" path="res://scenes/parallax_clouds.tscn" id="2_5vw27"]
|
||||
[ext_resource type="PackedScene" uid="uid://dmr0fcamx7t56" path="res://addons/virtual_joystick/virtual_joystick_scene.tscn" id="3_jbj1t"]
|
||||
[ext_resource type="Texture2D" uid="uid://b25w6ms7bxlhu" path="res://sprites/third space bgrnd.png" id="3_tipki"]
|
||||
[ext_resource type="PackedScene" uid="uid://s6wf3egdqtmh" path="res://scenes/ui.tscn" id="4_1bvp3"]
|
||||
[ext_resource type="Shader" uid="uid://x02irwg8ynvp" path="res://shaders/pixel_highlight.gdshader" id="4_272bh"]
|
||||
|
|
@ -11,6 +12,7 @@
|
|||
[ext_resource type="Shader" uid="uid://blxo4qgrkjiup" path="res://shaders/flash.gdshader" id="8_eb6dy"]
|
||||
[ext_resource type="PackedScene" uid="uid://cd1kwb8klcsb5" path="res://scenes/goose.tscn" id="9_85g3d"]
|
||||
[ext_resource type="AudioStream" uid="uid://c3e8sdfqcikp6" path="res://sounds/welcome.wav" id="10_choun"]
|
||||
[ext_resource type="Texture2D" uid="uid://bkvmydfn5saxg" path="res://addons/virtual_joystick/textures/joystick_tip.png" id="10_muem4"]
|
||||
[ext_resource type="PackedScene" uid="uid://drf1k1iulvy6f" path="res://scenes/wave.tscn" id="11_ya4ey"]
|
||||
[ext_resource type="AudioStream" uid="uid://i61hg7wispq6" path="res://sounds/Ambient 2.0.wav" id="12_trceg"]
|
||||
[ext_resource type="AudioStream" uid="uid://mjhprrmwn7qk" path="res://sounds/radio_tune.wav" id="14_a8y0u"]
|
||||
|
|
@ -67,6 +69,9 @@ shader_parameter/pixelate_line = 0
|
|||
shader = ExtResource("8_eb6dy")
|
||||
shader_parameter/intensity = 1.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_dp3eg"]
|
||||
radius = 46.98
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_5vw27"]
|
||||
|
||||
[node name="Main" type="Node2D" unique_id=128010797]
|
||||
|
|
@ -119,6 +124,34 @@ offset_bottom = 320.0
|
|||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VirtualControls" type="Node2D" parent="CanvasLayer" unique_id=728616058]
|
||||
|
||||
[node name="Virtual Joystick" parent="CanvasLayer/VirtualControls" unique_id=2019740770 instance=ExtResource("3_jbj1t")]
|
||||
process_mode = 3
|
||||
modulate = Color(1, 1, 1, 0.44000003)
|
||||
z_index = 10
|
||||
anchors_preset = -1
|
||||
offset_left = -2.999999
|
||||
offset_top = 228.0
|
||||
offset_right = 297.0
|
||||
offset_bottom = 528.0
|
||||
pressed_color = Color(0.7477647, 0.718735, 0.89654267, 1)
|
||||
clampzone_size = 40.0
|
||||
visibility_mode = 1
|
||||
action_left = "left"
|
||||
action_right = "right"
|
||||
action_up = "up"
|
||||
action_down = "down"
|
||||
|
||||
[node name="TouchScreenButton" type="TouchScreenButton" parent="CanvasLayer/VirtualControls" unique_id=1967993492]
|
||||
modulate = Color(1, 1, 1, 0.44000003)
|
||||
position = Vector2(180, 263)
|
||||
scale = Vector2(0.35, 0.35)
|
||||
texture_normal = ExtResource("10_muem4")
|
||||
shape = SubResource("CircleShape2D_dp3eg")
|
||||
action = "shoot"
|
||||
visibility_mode = 1
|
||||
|
||||
[node name="background" type="Sprite2D" parent="." unique_id=1790434669]
|
||||
visible = false
|
||||
z_index = -4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue