initial android export experiments
This commit is contained in:
parent
a2b9da421a
commit
8452ebce66
30 changed files with 755 additions and 1 deletions
14
autoloads/touch_controls.gd
Normal file
14
autoloads/touch_controls.gd
Normal file
|
@ -0,0 +1,14 @@
|
|||
extends CanvasLayer
|
||||
|
||||
export var opacity = 0.5
|
||||
|
||||
func _ready():
|
||||
if !OS.has_feature("mobile"):
|
||||
visible = false
|
||||
$CanvasModulate.color = Color(1.0, 1.0, 1.0, opacity)
|
||||
_reposition()
|
||||
get_tree().connect("screen_resized", self, "_reposition")
|
||||
|
||||
func _reposition():
|
||||
$Directions.position = Vector2(0.0, get_viewport().size.y)
|
||||
$Actions.position = get_viewport().size
|
104
autoloads/touch_controls.tscn
Normal file
104
autoloads/touch_controls.tscn
Normal file
|
@ -0,0 +1,104 @@
|
|||
[gd_scene load_steps=17 format=2]
|
||||
|
||||
[ext_resource path="res://autoloads/touch_controls.gd" type="Script" id=1]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_left.png" type="Texture" id=2]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_down_pressed.png" type="Texture" id=3]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_right_pressed.png" type="Texture" id=4]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_up.png" type="Texture" id=5]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_up_pressed.png" type="Texture" id=6]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_left_pressed.png" type="Texture" id=7]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_down.png" type="Texture" id=8]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_right.png" type="Texture" id=9]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_jump.png" type="Texture" id=10]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_shoot.png" type="Texture" id=11]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_jump_pressed.png" type="Texture" id=12]
|
||||
[ext_resource path="res://graphics/hud/touch/touch_shoot_pressed.png" type="Texture" id=13]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 40, 120 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 120, 40 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=3]
|
||||
extents = Vector2( 40, 40 )
|
||||
|
||||
[node name="TouchControls" type="CanvasLayer"]
|
||||
pause_mode = 2
|
||||
layer = 128
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CanvasModulate" type="CanvasModulate" parent="."]
|
||||
|
||||
[node name="Directions" type="Node2D" parent="."]
|
||||
|
||||
[node name="LeftButton" type="TouchScreenButton" parent="Directions"]
|
||||
position = Vector2( 0, -160 )
|
||||
normal = ExtResource( 2 )
|
||||
pressed = ExtResource( 7 )
|
||||
shape = SubResource( 1 )
|
||||
passby_press = true
|
||||
action = "ui_left"
|
||||
|
||||
[node name="RightButton" type="TouchScreenButton" parent="Directions"]
|
||||
position = Vector2( 160, -160 )
|
||||
normal = ExtResource( 9 )
|
||||
pressed = ExtResource( 4 )
|
||||
shape = SubResource( 1 )
|
||||
passby_press = true
|
||||
action = "ui_right"
|
||||
|
||||
[node name="UpButton" type="TouchScreenButton" parent="Directions"]
|
||||
position = Vector2( 80, -240 )
|
||||
normal = ExtResource( 5 )
|
||||
pressed = ExtResource( 6 )
|
||||
shape = SubResource( 2 )
|
||||
passby_press = true
|
||||
action = "ui_up"
|
||||
|
||||
[node name="DownButton" type="TouchScreenButton" parent="Directions"]
|
||||
position = Vector2( 80, -80 )
|
||||
normal = ExtResource( 8 )
|
||||
pressed = ExtResource( 3 )
|
||||
shape = SubResource( 2 )
|
||||
passby_press = true
|
||||
action = "ui_down"
|
||||
|
||||
[node name="Actions" type="Node2D" parent="."]
|
||||
|
||||
[node name="JumpButton" type="TouchScreenButton" parent="Actions"]
|
||||
position = Vector2( -80, -120 )
|
||||
normal = ExtResource( 10 )
|
||||
pressed = ExtResource( 12 )
|
||||
shape = SubResource( 3 )
|
||||
passby_press = true
|
||||
action = "jump"
|
||||
|
||||
[node name="AcceptButton" type="TouchScreenButton" parent="Actions"]
|
||||
position = Vector2( -80, -120 )
|
||||
shape = SubResource( 3 )
|
||||
passby_press = true
|
||||
action = "ui_accept"
|
||||
|
||||
[node name="ShootButton" type="TouchScreenButton" parent="Actions"]
|
||||
position = Vector2( -200, -120 )
|
||||
normal = ExtResource( 11 )
|
||||
pressed = ExtResource( 13 )
|
||||
shape = SubResource( 3 )
|
||||
passby_press = true
|
||||
action = "shoot"
|
||||
|
||||
[node name="CancelButton" type="TouchScreenButton" parent="Actions"]
|
||||
position = Vector2( -200, -120 )
|
||||
shape = SubResource( 3 )
|
||||
passby_press = true
|
||||
action = "ui_cancel"
|
||||
|
||||
[node name="PauseButton" type="TouchScreenButton" parent="Actions"]
|
||||
position = Vector2( 0, -400 )
|
||||
rotation = 1.5708
|
||||
normal = ExtResource( 11 )
|
||||
pressed = ExtResource( 12 )
|
||||
shape = SubResource( 3 )
|
||||
passby_press = true
|
||||
action = "pause"
|
Loading…
Add table
Add a link
Reference in a new issue