Basic character, trait and preference resources
This commit is contained in:
11
scenes/audio/background_music_player.gd
Normal file
11
scenes/audio/background_music_player.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends Node
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
print("coucou")
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
1
scenes/audio/background_music_player.gd.uid
Normal file
1
scenes/audio/background_music_player.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://qemsayf5o7r2
|
||||
12
scenes/audio/background_music_player.tscn
Normal file
12
scenes/audio/background_music_player.tscn
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_scene format=3 uid="uid://djyx7damwjgdg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://qemsayf5o7r2" path="res://scenes/audio/background_music_player.gd" id="1_c6vpr"]
|
||||
[ext_resource type="AudioStream" uid="uid://d4jic41p1g113" path="res://assets/audio/Troubadeck 32 Perserverance.ogg" id="2_ybvjt"]
|
||||
|
||||
[node name="BackgroundMusicPlayer" type="Node" unique_id=547672891]
|
||||
script = ExtResource("1_c6vpr")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="." unique_id=1328032237]
|
||||
stream = ExtResource("2_ybvjt")
|
||||
autoplay = true
|
||||
bus = &"Music"
|
||||
23
scenes/character/chara_resource.gd
Normal file
23
scenes/character/chara_resource.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
@tool
|
||||
extends Resource
|
||||
class_name CharacterResource
|
||||
|
||||
|
||||
@export var chara_sprite: Texture2D:
|
||||
set(value):
|
||||
chara_sprite = value
|
||||
changed.emit()
|
||||
|
||||
@export_category("Mask settings")
|
||||
@export var mask_eyes_location: Vector2 = Vector2.ZERO:
|
||||
set(value):
|
||||
mask_eyes_location = value
|
||||
changed.emit()
|
||||
@export var mask_mouth_location: Vector2 = Vector2.ZERO:
|
||||
set(value):
|
||||
mask_mouth_location = value
|
||||
changed.emit()
|
||||
|
||||
@export_category("Traits and preferences")
|
||||
@export var traits: Array[Trait]
|
||||
@export var preferences: Array[Preference]
|
||||
1
scenes/character/chara_resource.gd.uid
Normal file
1
scenes/character/chara_resource.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bwam50qxikpw4
|
||||
45
scenes/character/character.gd
Normal file
45
scenes/character/character.gd
Normal file
@@ -0,0 +1,45 @@
|
||||
@tool
|
||||
extends Node2D
|
||||
class_name Character
|
||||
|
||||
@export var chara_resource: CharacterResource:
|
||||
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)
|
||||
|
||||
@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.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
_engine_process(delta)
|
||||
else:
|
||||
_game_process(delta)
|
||||
|
||||
|
||||
func _game_process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _engine_process(delta: float) -> void:
|
||||
mask_eyes.position = mask_eyes_location
|
||||
mask_mouth.position = mask_mouth_location
|
||||
1
scenes/character/character.gd.uid
Normal file
1
scenes/character/character.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dnt4l1eghm1gi
|
||||
20
scenes/character/character.tscn
Normal file
20
scenes/character/character.tscn
Normal file
@@ -0,0 +1,20 @@
|
||||
[gd_scene format=3 uid="uid://bvpyqyftqhy45"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dnt4l1eghm1gi" path="res://scenes/character/character.gd" id="1_cuyo6"]
|
||||
[ext_resource type="Resource" uid="uid://da2ptl3f7h0ot" path="res://resources/characters/king.tres" id="2_fgi2k"]
|
||||
[ext_resource type="Texture2D" uid="uid://c57s3oksagauh" path="res://assets/sprites/sprites by judas la carotte/sprite3 happy small.png" id="3_f8hpl"]
|
||||
[ext_resource type="PackedScene" uid="uid://3jlukpb5hefb" path="res://scenes/mask/mask.tscn" id="3_mutn8"]
|
||||
|
||||
[node name="Character" type="Node2D" unique_id=138741531]
|
||||
script = ExtResource("1_cuyo6")
|
||||
chara_resource = ExtResource("2_fgi2k")
|
||||
|
||||
[node name="Face" type="Sprite2D" parent="." unique_id=855137033]
|
||||
texture = ExtResource("3_f8hpl")
|
||||
|
||||
[node name="MaskMouth" parent="." unique_id=1087336064 instance=ExtResource("3_mutn8")]
|
||||
position = Vector2(-13.425, -173.61)
|
||||
|
||||
[node name="MaskEyes" parent="." unique_id=428968220 instance=ExtResource("3_mutn8")]
|
||||
position = Vector2(-7.325, -274.11)
|
||||
scale = Vector2(2.599999, 0.76)
|
||||
14
scenes/character/preference.gd
Normal file
14
scenes/character/preference.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends Resource
|
||||
class_name Preference
|
||||
|
||||
enum Pref {
|
||||
LOVE,
|
||||
APPROVE,
|
||||
DONT_CARE,
|
||||
DISAPPROVE,
|
||||
HATE
|
||||
}
|
||||
|
||||
@export var name: String
|
||||
@export var trait_name: String
|
||||
@export var preference: Pref
|
||||
1
scenes/character/preference.gd.uid
Normal file
1
scenes/character/preference.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://djnkk7igqmtk
|
||||
11
scenes/character/tag.gd
Normal file
11
scenes/character/tag.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends Resource
|
||||
class_name TagResource
|
||||
|
||||
enum Stimuli {
|
||||
VISION,
|
||||
SPEAKING,
|
||||
HEARING
|
||||
}
|
||||
|
||||
@export var name: String
|
||||
@export var stimulis: Array[Stimuli]
|
||||
1
scenes/character/tag.gd.uid
Normal file
1
scenes/character/tag.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://837kteb5ihhm
|
||||
23
scenes/character/trait.gd
Normal file
23
scenes/character/trait.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
extends Resource
|
||||
class_name Trait
|
||||
|
||||
|
||||
enum Stimuli {
|
||||
VISION,
|
||||
SOUND,
|
||||
SMELL
|
||||
}
|
||||
|
||||
@export var name : String
|
||||
@export var stimulis : Array[Stimuli]
|
||||
@export var tags : Array[String]
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
1
scenes/character/trait.gd.uid
Normal file
1
scenes/character/trait.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cya40uohlvgbr
|
||||
@@ -1,9 +1,22 @@
|
||||
[gd_scene format=3 uid="uid://cukfdjcnb5tm6"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cftllq6l7xclt" path="res://icon.svg" id="1_ig7tw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bvpyqyftqhy45" path="res://scenes/character/character.tscn" id="1_o5qli"]
|
||||
[ext_resource type="Texture2D" uid="uid://cftllq6l7xclt" path="res://icon.svg" id="2_0wfyh"]
|
||||
|
||||
[node name="Node2D" type="Node2D" unique_id=875553242]
|
||||
[node name="Main" type="Node2D" unique_id=875553242]
|
||||
|
||||
[node name="Icon" type="Sprite2D" parent="." unique_id=2110381633]
|
||||
position = Vector2(118, 108)
|
||||
texture = ExtResource("1_ig7tw")
|
||||
[node name="Character" parent="." unique_id=138741531 instance=ExtResource("1_o5qli")]
|
||||
position = Vector2(933, 598)
|
||||
scale = Vector2(0.5488516, 0.5501616)
|
||||
|
||||
[node name="Node2D" type="Node2D" parent="." unique_id=423016219]
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="." unique_id=897724120]
|
||||
position = Vector2(437, 790.00006)
|
||||
scale = Vector2(2.623044, 6.1738076)
|
||||
texture = ExtResource("2_0wfyh")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1584569522]
|
||||
position = Vector2(846, 943)
|
||||
scale = Vector2(9.480545, 1.8921106)
|
||||
texture = ExtResource("2_0wfyh")
|
||||
|
||||
12
scenes/mask/mask.gd
Normal file
12
scenes/mask/mask.gd
Normal file
@@ -0,0 +1,12 @@
|
||||
extends Node2D
|
||||
class_name Mask
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
1
scenes/mask/mask.gd.uid
Normal file
1
scenes/mask/mask.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cfo3mk5f2q3ej
|
||||
10
scenes/mask/mask.tscn
Normal file
10
scenes/mask/mask.tscn
Normal file
@@ -0,0 +1,10 @@
|
||||
[gd_scene format=3 uid="uid://3jlukpb5hefb"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cfo3mk5f2q3ej" path="res://scenes/mask/mask.gd" id="1_61b51"]
|
||||
[ext_resource type="Texture2D" uid="uid://cftllq6l7xclt" path="res://icon.svg" id="1_jlvus"]
|
||||
|
||||
[node name="Mask" type="Node2D" unique_id=428968220]
|
||||
script = ExtResource("1_61b51")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1997645103]
|
||||
texture = ExtResource("1_jlvus")
|
||||
Reference in New Issue
Block a user