Updated UI
This commit is contained in:
Binary file not shown.
@@ -39,6 +39,11 @@ func _process(delta):
|
|||||||
dst = ndst
|
dst = ndst
|
||||||
closest = k
|
closest = k
|
||||||
emit_signal("action1", closest)
|
emit_signal("action1", closest)
|
||||||
|
if Input.is_action_just_pressed("screenshot"):
|
||||||
|
var img = get_viewport().get_texture().get_data()
|
||||||
|
img.flip_y()
|
||||||
|
img.save_png("user://screenshot.png")
|
||||||
|
print("screenshot saved to ", OS.get_user_data_dir(), "/screenshot.png")
|
||||||
var act_obj = null
|
var act_obj = null
|
||||||
var act_dist = -1.0
|
var act_dist = -1.0
|
||||||
var opos = master_node.global_transform.origin
|
var opos = master_node.global_transform.origin
|
||||||
@@ -62,12 +67,14 @@ func _process(delta):
|
|||||||
monitored_objects.push_back(act_obj)
|
monitored_objects.push_back(act_obj)
|
||||||
if act_obj.is_in_group("characters"):
|
if act_obj.is_in_group("characters"):
|
||||||
mon_labels[act_obj] = talk_icon.instance()
|
mon_labels[act_obj] = talk_icon.instance()
|
||||||
|
mon_labels[act_obj].rect_position = camera.unproject_position(act_obj.head_node.global_transform.origin) + Vector2(-40.0, -80.0)
|
||||||
else:
|
else:
|
||||||
mon_labels[act_obj] = Button.new()
|
mon_labels[act_obj] = Button.new()
|
||||||
mon_labels[act_obj].text = act_obj.get_act()
|
mon_labels[act_obj].text = act_obj.get_act()
|
||||||
|
mon_labels[act_obj].rect_position = camera.unproject_position(act_obj.global_transform.origin)
|
||||||
mon_labels[act_obj].connect("pressed", self, "emit_signal", ["action1", act_obj])
|
mon_labels[act_obj].connect("pressed", self, "emit_signal", ["action1", act_obj])
|
||||||
add_child(mon_labels[act_obj])
|
add_child(mon_labels[act_obj])
|
||||||
mon_labels[act_obj].rect_position = camera.unproject_position(act_obj.global_transform.origin)
|
# mon_labels[act_obj].rect_position = camera.unproject_position(act_obj.global_transform.origin)
|
||||||
for k in monitored_objects:
|
for k in monitored_objects:
|
||||||
var epos = k.global_transform.origin
|
var epos = k.global_transform.origin
|
||||||
var new_dist = opos.distance_squared_to(epos)
|
var new_dist = opos.distance_squared_to(epos)
|
||||||
@@ -77,7 +84,11 @@ func _process(delta):
|
|||||||
mon_labels.erase(k)
|
mon_labels.erase(k)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
mon_labels[k].rect_position = camera.unproject_position(k.global_transform.origin)
|
if k.is_in_group("characters"):
|
||||||
|
mon_labels[k].rect_position = camera.unproject_position(k.head_node.global_transform.origin)
|
||||||
|
mon_labels[k].rect_position += Vector2(-40.0, -80.0)
|
||||||
|
else:
|
||||||
|
mon_labels[k].rect_position = camera.unproject_position(k.global_transform.origin)
|
||||||
|
|
||||||
|
|
||||||
var click2d: Vector2 = Vector2()
|
var click2d: Vector2 = Vector2()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ var aplay: AnimationPlayer
|
|||||||
const GRAVITY = Vector3(0, -9.8, 0)
|
const GRAVITY = Vector3(0, -9.8, 0)
|
||||||
var ball_carry: Node
|
var ball_carry: Node
|
||||||
var item_right_hand: Node
|
var item_right_hand: Node
|
||||||
|
var head_node: Node
|
||||||
# Declare member variables here. Examples:
|
# Declare member variables here. Examples:
|
||||||
# var a = 2
|
# var a = 2
|
||||||
# var b = "text"
|
# var b = "text"
|
||||||
@@ -36,6 +37,9 @@ func _ready():
|
|||||||
add_to_group("characters")
|
add_to_group("characters")
|
||||||
add_to_group("activatable")
|
add_to_group("activatable")
|
||||||
ball_carry = get_children()[0].get_children()[0].get_node("item_carry/ball_carry")
|
ball_carry = get_children()[0].get_children()[0].get_node("item_carry/ball_carry")
|
||||||
|
head_node = BoneAttachment.new()
|
||||||
|
skel.add_child(head_node)
|
||||||
|
head_node.bone_name = "head"
|
||||||
|
|
||||||
func get_act():
|
func get_act():
|
||||||
return "Talk"
|
return "Talk"
|
||||||
|
|||||||
187
proto2/main.tscn
187
proto2/main.tscn
File diff suppressed because one or more lines are too long
@@ -91,3 +91,8 @@ action1={
|
|||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
screenshot={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":80,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ bg_color = Color( 0.6, 0.6, 0.6, 0 )
|
|||||||
[sub_resource type="AtlasTexture" id=6]
|
[sub_resource type="AtlasTexture" id=6]
|
||||||
flags = 4
|
flags = 4
|
||||||
atlas = ExtResource( 1 )
|
atlas = ExtResource( 1 )
|
||||||
region = Rect2( 8, 945, 92, 80 )
|
region = Rect2( 15, 0, 48, 50 )
|
||||||
|
margin = Rect2( 0, 0, 0, 4 )
|
||||||
|
|
||||||
[node name="act_talk" type="Button"]
|
[node name="act_talk" type="Button"]
|
||||||
margin_right = 96.0
|
margin_right = 96.0
|
||||||
|
|||||||
8
proto2/ui/hire_cheer_icon.tres
Normal file
8
proto2/ui/hire_cheer_icon.tres
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://ui/icons.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 111, 0, 32, 60 )
|
||||||
8
proto2/ui/hire_team_icon.tres
Normal file
8
proto2/ui/hire_team_icon.tres
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://ui/icons.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 79, 0, 32, 60 )
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 26 KiB |
@@ -1,6 +1,8 @@
|
|||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://ui/interaction.gd" type="Script" id=1]
|
[ext_resource path="res://ui/interaction.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://ui/hire_team_icon.tres" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://ui/hire_cheer_icon.tres" type="Texture" id=3]
|
||||||
|
|
||||||
[node name="interaction" type="Control"]
|
[node name="interaction" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -24,18 +26,19 @@ __meta__ = {
|
|||||||
margin_right = 64.0
|
margin_right = 64.0
|
||||||
margin_bottom = 64.0
|
margin_bottom = 64.0
|
||||||
rect_min_size = Vector2( 64, 64 )
|
rect_min_size = Vector2( 64, 64 )
|
||||||
|
texture_normal = ExtResource( 2 )
|
||||||
[node name="Polygon2D" type="Polygon2D" parent="h/hire_team"]
|
texture_pressed = ExtResource( 2 )
|
||||||
polygon = PoolVector2Array( 11.513, 35.9185, 25.1051, 23.7134, 38.1424, 35.0864 )
|
texture_hover = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="hire_cheer_team" type="TextureButton" parent="h"]
|
[node name="hire_cheer_team" type="TextureButton" parent="h"]
|
||||||
margin_left = 68.0
|
margin_left = 68.0
|
||||||
margin_right = 132.0
|
margin_right = 132.0
|
||||||
margin_bottom = 64.0
|
margin_bottom = 64.0
|
||||||
rect_min_size = Vector2( 64, 64 )
|
rect_min_size = Vector2( 64, 64 )
|
||||||
|
texture_normal = ExtResource( 3 )
|
||||||
|
texture_pressed = ExtResource( 3 )
|
||||||
|
texture_hover = ExtResource( 3 )
|
||||||
|
texture_focused = ExtResource( 3 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Polygon2D2" type="Polygon2D" parent="h/hire_cheer_team"]
|
|
||||||
polygon = PoolVector2Array( 11.513, 35.9185, 25.1051, 23.7134, 38.1424, 35.0864 )
|
|
||||||
|
|||||||
Reference in New Issue
Block a user