Mask setup
This commit is contained in:
@@ -10,19 +10,32 @@ enum Preference {
|
||||
HATE
|
||||
}
|
||||
|
||||
@export_category("General")
|
||||
@export var chara_sprite: Texture2D:
|
||||
set(value):
|
||||
chara_sprite = value
|
||||
changed.emit()
|
||||
|
||||
@export_category("Mask settings")
|
||||
@export var mask_eyes_location: Vector2 = Vector2.ZERO:
|
||||
@export_group("Eyes")
|
||||
@export var mask_eyes_position: Vector2 = Vector2.ZERO:
|
||||
set(value):
|
||||
mask_eyes_location = value
|
||||
mask_eyes_position = value
|
||||
changed.emit()
|
||||
@export var mask_mouth_location: Vector2 = Vector2.ZERO:
|
||||
@export_custom(PROPERTY_HINT_RANGE, "-360,360,0.1,or_greater,or_less,radians")
|
||||
var mask_eyes_rotation : float = 0.0:
|
||||
set(value):
|
||||
mask_mouth_location = value
|
||||
mask_eyes_rotation = value
|
||||
changed.emit()
|
||||
@export_group("Mouth")
|
||||
@export var mask_mouth_position: Vector2 = Vector2.ZERO:
|
||||
set(value):
|
||||
mask_mouth_position = value
|
||||
changed.emit()
|
||||
@export_custom(PROPERTY_HINT_RANGE, "-360,360,0.1,or_greater,or_less,radians")
|
||||
var mask_mouth_rotation : float = 0.0:
|
||||
set(value):
|
||||
mask_mouth_rotation = value
|
||||
changed.emit()
|
||||
|
||||
@export_category("Traits and preferences")
|
||||
|
||||
@@ -6,21 +6,16 @@ class_name Character
|
||||
set(new_resource):
|
||||
chara_resource = new_resource
|
||||
_on_chara_resource_changed()
|
||||
# Connect the changed signal as soon as a new resource is being added.
|
||||
if chara_resource != null:
|
||||
chara_resource.changed.connect(_on_chara_resource_changed)
|
||||
if chara_resource == null:
|
||||
return
|
||||
chara_resource.changed.connect(_on_chara_resource_changed)
|
||||
|
||||
@onready var face: Sprite2D = $Face
|
||||
@onready var mask_eyes: Mask = $MaskEyes
|
||||
@onready var mask_mouth: Mask = $MaskMouth
|
||||
|
||||
var mask_eyes_location: Vector2
|
||||
var mask_mouth_location: Vector2
|
||||
|
||||
func _on_chara_resource_changed() -> void:
|
||||
face.texture = chara_resource.chara_sprite
|
||||
mask_eyes_location = chara_resource.mask_eyes_location
|
||||
mask_mouth_location = chara_resource.mask_mouth_location
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
@@ -41,5 +36,10 @@ func _game_process(delta: float) -> void:
|
||||
|
||||
|
||||
func _engine_process(delta: float) -> void:
|
||||
mask_eyes.position = mask_eyes_location
|
||||
mask_mouth.position = mask_mouth_location
|
||||
if chara_resource == null:
|
||||
return
|
||||
|
||||
mask_eyes.position = chara_resource.mask_eyes_position
|
||||
mask_eyes.rotation = chara_resource.mask_eyes_rotation
|
||||
mask_mouth.position = chara_resource.mask_mouth_position
|
||||
mask_mouth.rotation = chara_resource.mask_mouth_rotation
|
||||
|
||||
@@ -13,8 +13,9 @@ chara_resource = ExtResource("2_fgi2k")
|
||||
texture = ExtResource("3_f8hpl")
|
||||
|
||||
[node name="MaskMouth" parent="." unique_id=1087336064 instance=ExtResource("3_mutn8")]
|
||||
position = Vector2(-13.425, -173.61)
|
||||
position = Vector2(-7.63, -186.87)
|
||||
rotation = -0.18849556
|
||||
|
||||
[node name="MaskEyes" parent="." unique_id=428968220 instance=ExtResource("3_mutn8")]
|
||||
position = Vector2(-7.325, -274.11)
|
||||
scale = Vector2(2.599999, 0.76)
|
||||
position = Vector2(-21.75, -274.015)
|
||||
rotation = 0.06981317
|
||||
|
||||
Reference in New Issue
Block a user