touch controls (WIP)

This commit is contained in:
Page Asgardius 2024-12-01 18:07:54 -07:00
parent 03fcea9d15
commit a064871ba5
51 changed files with 545 additions and 0 deletions

View file

@ -0,0 +1,3 @@
source_md5="51780c8bf5283cb0a6fbf57946224f4d"
dest_md5="1952a0401f4be037d1ae3c3d004bc7fe"

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="2fe4d318ce0e70b28fb5b47482fb548c"
dest_md5="cbf912993b6c7cb951c016ab13116c9c"

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="59f89dc2ba8febbbd8c99234ba106910"
dest_md5="a60a39c3a5165f55d372d435461b6a50"

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="0e14733f882021dba49fa7cb7b951863"
dest_md5="49d4bf843e7939d788cbb67fca9c5c9a"

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="d4f13c50c3235ed377cf585a34eba23a"
dest_md5="f1fa8c13253cbd1d946de408e363929b"

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="117d889c7d58b5469d5384e09be273af"
dest_md5="3852ad7263f8cd7b84ce862cac2e2313"

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="b9291d1167c25ea029a30e0e8d14b908"
dest_md5="51ce942991eb87e61b3eaa9b785b4d32"

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="bb1c9491a43245519dab7e16674996c0"
dest_md5="c71d4bb747790c118da7a3e32e5a9a6f"

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="7f3cd3f6ec7bded1321f3e47d4541d48"
dest_md5="a6d693279230dceff3674d7a8a98587a"

View file

@ -0,0 +1,3 @@
source_md5="6c543278fca7dd655e993a600139a9f0"
dest_md5="d777372bad39f08f13166b5498d2b9a0"

View file

@ -0,0 +1,3 @@
source_md5="9ec879df51b1a4e02e2ac384fbfc69a4"
dest_md5="2f26e5673a5741d6a8c6fd1baae42fed"

View file

@ -0,0 +1,3 @@
source_md5="45505e278b02ef51e5885d4d06faaf85"
dest_md5="7403908dcadc6881ffc6398e744a14c7"

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="7836b4b121d4bfc06e1dcba0fbf30e0c"
dest_md5="89d90b0632d0d8a163348ac538a49405"

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="5930f0392b60dcebff2cf6a0b95a8c36"
dest_md5="dc02d55149313fa54c77defa27eaf72d"

Binary file not shown.

View file

@ -10,6 +10,7 @@ var bhud = load("res://levels/bottomhud.tscn").instance()
var thud = load("res://levels/ui/tophud.tscn").instance()
var pmenu = load("res://levels/ui/pause.tscn").instance()
var mgamepad = load("res://levels/ui/missinggamepad.tscn").instance()
var tcontrol = load("res://levels/ui/touchcontrols.tscn").instance()
var ismgamepad = false
var ispaused = false
var ishud = true
@ -65,6 +66,7 @@ func _ready():
call_deferred("_level")
call_deferred("_bhud")
call_deferred("_thud")
call_deferred("_tcontrol")
#get_tree().root.add_child.call_deferred(player)
bgsound.stream = music
bgsound.bus = "Music"
@ -165,6 +167,7 @@ func _exit():
Global.bossready = false
Global.cboss = [null, null, null]
#if Global.live == 4:
get_tree().root.remove_child(tcontrol)
get_tree().root.remove_child(pmenu)
#else:
# get_tree().root.remove_child(thud)
@ -213,3 +216,6 @@ func _pmenu():
func _mgamepad():
get_tree().root.add_child(mgamepad)
func _tcontrol():
get_tree().root.add_child(tcontrol)

View file

@ -0,0 +1,56 @@
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_A_pressed():
Input.action_press("shoot")
func _on_A_released():
Input.action_release("shoot")
func _on_Up_pressed():
Input.action_press("ui_up")
func _on_Up_released():
Input.action_release("ui_up")
func _on_Down_pressed():
Input.action_press("ui_down")
func _on_Down_released():
Input.action_release("ui_down")
func _on_Left_pressed():
Input.action_press("ui_left")
func _on_Left_released():
Input.action_release("ui_left")
func _on_Right_pressed():
Input.action_press("ui_right")
func _on_Right_released():
Input.action_release("ui_right")

View file

@ -0,0 +1,91 @@
[gd_scene load_steps=12 format=2]
[ext_resource path="res://levels/ui/touchcontrols.gd" type="Script" id=1]
[ext_resource path="res://sprites/buttons/B.png" type="Texture" id=2]
[ext_resource path="res://sprites/buttons/A.png" type="Texture" id=3]
[ext_resource path="res://sprites/buttons/Y.png" type="Texture" id=4]
[ext_resource path="res://sprites/buttons/LT.png" type="Texture" id=5]
[ext_resource path="res://sprites/buttons/LB.png" type="Texture" id=6]
[ext_resource path="res://sprites/buttons/X.png" type="Texture" id=7]
[ext_resource path="res://sprites/buttons/RB.png" type="Texture" id=8]
[ext_resource path="res://sprites/buttons/RT.png" type="Texture" id=9]
[sub_resource type="Gradient" id=3]
offsets = PoolRealArray( 0.583333, 1 )
colors = PoolColorArray( 1, 1, 1, 1, 1, 1, 1, 1 )
[sub_resource type="GradientTexture" id=4]
gradient = SubResource( 3 )
width = 32
[node name="Touchcontrols" type="Node2D"]
script = ExtResource( 1 )
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="B" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 1142, 586 )
scale = Vector2( 1.5, 1.5 )
normal = ExtResource( 2 )
[node name="A" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 1007, 586 )
scale = Vector2( 1.5, 1.5 )
normal = ExtResource( 3 )
[node name="Y" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 1142, 479 )
scale = Vector2( 1.5, 1.5 )
normal = ExtResource( 4 )
[node name="X" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 1007, 479 )
scale = Vector2( 1.5, 1.5 )
normal = ExtResource( 7 )
[node name="R1" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 872, 501 )
normal = ExtResource( 8 )
[node name="R2" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 917, 573 )
normal = ExtResource( 9 )
[node name="L1" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 20, 372 )
normal = ExtResource( 6 )
[node name="L2" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 155, 372 )
normal = ExtResource( 5 )
[node name="Up" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 139, 475 )
scale = Vector2( 2, 55 )
normal = SubResource( 4 )
[node name="Down" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 139, 585 )
scale = Vector2( 2, 55 )
normal = SubResource( 4 )
[node name="Left" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 75, 530 )
scale = Vector2( 2, 54.9999 )
normal = SubResource( 4 )
[node name="Right" type="TouchScreenButton" parent="CanvasLayer"]
position = Vector2( 203, 530 )
scale = Vector2( 2, 54.9999 )
normal = SubResource( 4 )
[connection signal="pressed" from="CanvasLayer/A" to="." method="_on_A_pressed"]
[connection signal="released" from="CanvasLayer/A" to="." method="_on_A_released"]
[connection signal="pressed" from="CanvasLayer/Up" to="." method="_on_Up_pressed"]
[connection signal="released" from="CanvasLayer/Up" to="." method="_on_Up_released"]
[connection signal="pressed" from="CanvasLayer/Down" to="." method="_on_Down_pressed"]
[connection signal="released" from="CanvasLayer/Down" to="." method="_on_Down_released"]
[connection signal="pressed" from="CanvasLayer/Left" to="." method="_on_Left_pressed"]
[connection signal="released" from="CanvasLayer/Left" to="." method="_on_Left_released"]
[connection signal="pressed" from="CanvasLayer/Right" to="." method="_on_Right_pressed"]
[connection signal="released" from="CanvasLayer/Right" to="." method="_on_Right_released"]

BIN
sprites/buttons/A.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/A.png-e8eb459bc6556ccd2a36bb0444aec579.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/buttons/A.png"
dest_files=[ "res://.import/A.png-e8eb459bc6556ccd2a36bb0444aec579.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
sprites/buttons/B.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/B.png-9d07cbf92eb8b76cf9538cdcd552fb23.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/buttons/B.png"
dest_files=[ "res://.import/B.png-9d07cbf92eb8b76cf9538cdcd552fb23.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
sprites/buttons/LB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/LB.png-c5075b1a373b12e705fb0c6ef0b5f91b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/buttons/LB.png"
dest_files=[ "res://.import/LB.png-c5075b1a373b12e705fb0c6ef0b5f91b.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
sprites/buttons/LT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/LT.png-625b794033c3146c354a9bff9bba5745.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/buttons/LT.png"
dest_files=[ "res://.import/LT.png-625b794033c3146c354a9bff9bba5745.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
sprites/buttons/RB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/RB.png-9bfa19bd8ee72f92a34cc2cf0fa6a0e8.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/buttons/RB.png"
dest_files=[ "res://.import/RB.png-9bfa19bd8ee72f92a34cc2cf0fa6a0e8.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
sprites/buttons/RT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/RT.png-4b41c129ee4b7ab06535a770c9bf6745.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/buttons/RT.png"
dest_files=[ "res://.import/RT.png-4b41c129ee4b7ab06535a770c9bf6745.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
sprites/buttons/Select.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Select.png-2951067d745bfd58a019bc8cfbc73aae.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/buttons/Select.png"
dest_files=[ "res://.import/Select.png-2951067d745bfd58a019bc8cfbc73aae.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
sprites/buttons/Start.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Start.png-49afd20a2a79c62edf7a20d57a620d7a.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/buttons/Start.png"
dest_files=[ "res://.import/Start.png-49afd20a2a79c62edf7a20d57a620d7a.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
sprites/buttons/X.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/X.png-33658b17beabdb71e23c968c353ba50b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/buttons/X.png"
dest_files=[ "res://.import/X.png-33658b17beabdb71e23c968c353ba50b.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
sprites/buttons/Y.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Y.png-4f6bbe77615952118d9ae8dad67f8070.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/buttons/Y.png"
dest_files=[ "res://.import/Y.png-4f6bbe77615952118d9ae8dad67f8070.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0