configurable speccy
This commit is contained in:
parent
0d570f3dad
commit
ac0f3c8d58
3 changed files with 118 additions and 18 deletions
|
@ -137,7 +137,7 @@ position = Vector2( 27, 128 )
|
|||
|
||||
[node name="Button" parent="." instance=ExtResource( 19 )]
|
||||
position = Vector2( 16, 168 )
|
||||
target_group = "a"
|
||||
target_group = "speccy"
|
||||
|
||||
[node name="Cop" parent="." instance=ExtResource( 25 )]
|
||||
position = Vector2( 184, 112 )
|
||||
|
@ -203,7 +203,8 @@ position = Vector2( 144, 24 )
|
|||
[node name="FallingBlock" parent="." instance=ExtResource( 24 )]
|
||||
position = Vector2( 124, 96 )
|
||||
|
||||
[node name="speccy" parent="." instance=ExtResource( 2 )]
|
||||
[node name="speccy" parent="." groups=["speccy"] instance=ExtResource( 2 )]
|
||||
position = Vector2( 82, 72 )
|
||||
message = "go_get_em"
|
||||
|
||||
[editable path="RollingFiend"]
|
||||
|
|
61
objects/npc/speccy.gd
Normal file
61
objects/npc/speccy.gd
Normal file
|
@ -0,0 +1,61 @@
|
|||
tool
|
||||
extends Node2D
|
||||
|
||||
|
||||
export(String, DIR) var messages_dir: String setget _set_messages_dir
|
||||
#export
|
||||
var message: String setget _set_message
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if Engine.editor_hint:
|
||||
return
|
||||
|
||||
scale.x = 0.0
|
||||
$Message.texture = load("%s/%s.png" % [messages_dir, message])
|
||||
|
||||
|
||||
func appear() -> void:
|
||||
$AnimationPlayer.play("fun")
|
||||
|
||||
|
||||
func switch_action() -> void:
|
||||
appear()
|
||||
|
||||
|
||||
func _set_messages_dir(value: String) -> void:
|
||||
messages_dir = value
|
||||
property_list_changed_notify()
|
||||
|
||||
|
||||
func _set_message(value: String) -> void:
|
||||
message = value
|
||||
if not Engine.editor_hint:
|
||||
return
|
||||
$Message.texture = load("%s/%s.png" % [messages_dir, message])
|
||||
|
||||
|
||||
func _get_property_list() -> Array:
|
||||
var files: String = ""
|
||||
var dir: Directory = Directory.new()
|
||||
print(messages_dir)
|
||||
if dir.open(messages_dir) == OK:
|
||||
dir.list_dir_begin(true, true)
|
||||
var file_name: String = dir.get_next()
|
||||
while file_name != "":
|
||||
if not dir.current_is_dir() and file_name.ends_with(".png"):
|
||||
print("found file: ", file_name)
|
||||
files += "%s," % file_name.trim_suffix(".png")
|
||||
file_name = dir.get_next()
|
||||
files = files.trim_suffix(",")
|
||||
else:
|
||||
push_error("Failed to open dir: %s" % messages_dir)
|
||||
print(files)
|
||||
return [
|
||||
{
|
||||
name = "message",
|
||||
type = TYPE_STRING,
|
||||
hint = PROPERTY_HINT_ENUM,
|
||||
hint_string = files,
|
||||
}
|
||||
]
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=11 format=2]
|
||||
[gd_scene load_steps=12 format=2]
|
||||
|
||||
[ext_resource path="res://graphics/npc/speccy.png" type="Texture" id=1]
|
||||
[ext_resource path="res://shaders/beam_cycle.gdshader" type="Shader" id=2]
|
||||
|
@ -6,16 +6,13 @@
|
|||
[ext_resource path="res://graphics/hud/speccy/over_here.png" type="Texture" id=4]
|
||||
[ext_resource path="res://graphics/npc/speccy_talk.png" type="Texture" id=5]
|
||||
[ext_resource path="res://graphics/npc/speccy_cool.png" type="Texture" id=6]
|
||||
[ext_resource path="res://objects/npc/speccy.gd" type="Script" id=7]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=3]
|
||||
shader = ExtResource( 2 )
|
||||
shader_param/cycle_speed = 4.0
|
||||
shader_param/gradient = ExtResource( 3 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 6 )
|
||||
region = Rect2( 72, 0, 24, 24 )
|
||||
|
||||
[sub_resource type="Animation" id=1]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
|
@ -43,7 +40,7 @@ tracks/1/keys = {
|
|||
"values": [ Color( 1, 1, 1, 1 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Sprite2:scale")
|
||||
tracks/2/path = NodePath("Message:scale")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
|
@ -52,7 +49,7 @@ tracks/2/keys = {
|
|||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0.155205, 1 ) ]
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("Sprite:hframes")
|
||||
|
@ -66,6 +63,34 @@ tracks/3/keys = {
|
|||
"update": 1,
|
||||
"values": [ 1 ]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/path = NodePath("Sprite:texture")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ ExtResource( 1 ) ]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/path = NodePath(".:scale")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 6 )
|
||||
region = Rect2( 72, 0, 24, 24 )
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
resource_name = "fun"
|
||||
|
@ -96,7 +121,7 @@ tracks/1/keys = {
|
|||
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Sprite2:scale")
|
||||
tracks/2/path = NodePath("Message:scale")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
|
@ -155,26 +180,39 @@ tracks/6/keys = {
|
|||
"update": 1,
|
||||
"values": [ ExtResource( 1 ), SubResource( 4 ) ]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/path = NodePath(".:scale")
|
||||
tracks/7/interp = 1
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
|
||||
[node name="speccy" type="Node2D"]
|
||||
script = ExtResource( 7 )
|
||||
messages_dir = "res://graphics/hud/speccy"
|
||||
message = "over_here"
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -12 )
|
||||
texture = ExtResource( 6 )
|
||||
offset = Vector2( -2, 0 )
|
||||
region_rect = Rect2( 1.015, 0, 0, 0 )
|
||||
position = Vector2( -1, -12 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( -1, 0 )
|
||||
|
||||
[node name="Overlay" type="Sprite" parent="Sprite"]
|
||||
material = SubResource( 3 )
|
||||
texture = SubResource( 4 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 1, 0 )
|
||||
region_rect = Rect2( 1.015, 0, 0, 0 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
autoplay = "fun"
|
||||
anims/RESET = SubResource( 1 )
|
||||
anims/fun = SubResource( 2 )
|
||||
|
||||
[node name="Sprite2" type="Sprite" parent="."]
|
||||
[node name="Message" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -24 )
|
||||
scale = Vector2( 0.155205, 1 )
|
||||
texture = ExtResource( 4 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue