diff --git a/Graphics/Fonts/DescriptionNameFont.tres b/Graphics/Fonts/DescriptionNameFont.tres new file mode 100644 index 0000000..4d6c48b --- /dev/null +++ b/Graphics/Fonts/DescriptionNameFont.tres @@ -0,0 +1,8 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://Graphics/Fonts/SourceFonts/Fragmentcore.otf" type="DynamicFontData" id=1] + +[resource] +use_mipmaps = true +use_filter = true +font_data = ExtResource( 1 ) diff --git a/Graphics/Fonts/SourceFonts/Fragmentcore.otf b/Graphics/Fonts/SourceFonts/Fragmentcore.otf new file mode 100644 index 0000000..c43c34e Binary files /dev/null and b/Graphics/Fonts/SourceFonts/Fragmentcore.otf differ diff --git a/Graphics/Fonts/SourceFonts/WigendaTypewrite.ttf b/Graphics/Fonts/SourceFonts/WigendaTypewrite.ttf new file mode 100644 index 0000000..3d2b625 Binary files /dev/null and b/Graphics/Fonts/SourceFonts/WigendaTypewrite.ttf differ diff --git a/Graphics/Fonts/SourceFonts/typewcond_bold.otf b/Graphics/Fonts/SourceFonts/typewcond_bold.otf new file mode 100644 index 0000000..b4afb34 Binary files /dev/null and b/Graphics/Fonts/SourceFonts/typewcond_bold.otf differ diff --git a/Graphics/Fonts/SourceFonts/typewcond_demi.otf b/Graphics/Fonts/SourceFonts/typewcond_demi.otf new file mode 100644 index 0000000..af39b61 Binary files /dev/null and b/Graphics/Fonts/SourceFonts/typewcond_demi.otf differ diff --git a/Graphics/Fonts/SourceFonts/typewcond_regular.otf b/Graphics/Fonts/SourceFonts/typewcond_regular.otf new file mode 100644 index 0000000..b7b6f55 Binary files /dev/null and b/Graphics/Fonts/SourceFonts/typewcond_regular.otf differ diff --git a/Graphics/interrogation.png b/Graphics/interrogation.png new file mode 100644 index 0000000..399e7bf Binary files /dev/null and b/Graphics/interrogation.png differ diff --git a/Graphics/interrogation.png.import b/Graphics/interrogation.png.import new file mode 100644 index 0000000..9b18087 --- /dev/null +++ b/Graphics/interrogation.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/interrogation.png-e9f01f1292132d3f8424de55fbf2e416.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Graphics/interrogation.png" +dest_files=[ "res://.import/interrogation.png-e9f01f1292132d3f8424de55fbf2e416.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Scenes/PersonBase.tscn b/Scenes/PersonBase.tscn index 399cb6a..584ea6e 100644 --- a/Scenes/PersonBase.tscn +++ b/Scenes/PersonBase.tscn @@ -5,10 +5,10 @@ [ext_resource path="res://Scripts/PersonBody.gd" type="Script" id=3] [ext_resource path="res://Scripts/PersonRoot.gd" type="Script" id=4] -[sub_resource type="RectangleShape2D" id=2] +[sub_resource type="RectangleShape2D" id=1] extents = Vector2( 16, 16 ) -[sub_resource type="SpriteFrames" id=1] +[sub_resource type="SpriteFrames" id=2] animations = [ { "frames": [ ], "loop": true, @@ -34,8 +34,10 @@ script = ExtResource( 3 ) [node name="PersonShape" type="CollisionShape2D" parent="PersonBody"] visible = false -shape = SubResource( 2 ) +shape = SubResource( 1 ) [node name="PersonSprite" type="AnimatedSprite" parent="PersonBody"] -frames = SubResource( 1 ) +frames = SubResource( 2 ) animation = "New Anim" +[connection signal="mouse_entered" from="PersonBody" to="PersonBody" method="onMouseEnter"] +[connection signal="mouse_exited" from="PersonBody" to="PersonBody" method="onMouseLeft"] diff --git a/Scenes/TestScn.tscn b/Scenes/TestScn.tscn index 000a559..86bea42 100644 --- a/Scenes/TestScn.tscn +++ b/Scenes/TestScn.tscn @@ -1,9 +1,38 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=14 format=2] [ext_resource path="res://Scripts/rotaa.gd" type="Script" id=1] [ext_resource path="res://Graphics/Placeholder.png" type="Texture" id=2] [ext_resource path="res://Scenes/PersonBase.tscn" type="PackedScene" id=3] [ext_resource path="res://Scenes/Spot.tscn" type="PackedScene" id=4] +[ext_resource path="res://Graphics/interrogation.png" type="Texture" id=5] +[ext_resource path="res://Graphics/Fonts/DescriptionNameFont.tres" type="DynamicFont" id=6] +[ext_resource path="res://Scripts/DescriptionPane.gd" type="Script" id=7] +[ext_resource path="res://Scripts/Description.gd" type="Script" id=8] +[ext_resource path="res://Scripts/Trait.gd" type="Script" id=9] + +[sub_resource type="Resource" id=2] +script = ExtResource( 9 ) +id = "" +string = "Fancies the company of a cat." +type = 0 + +[sub_resource type="Resource" id=3] +script = ExtResource( 9 ) +id = "" +string = "Finds peanuts quite horrid." +type = 0 + +[sub_resource type="Resource" id=4] +script = ExtResource( 9 ) +id = "" +string = "Is an hipster." +type = 0 + +[sub_resource type="Resource" id=1] +script = ExtResource( 8 ) +name = "Jean-jacques pélo" +subtitle = "Hipster" +traits = [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ] [node name="Scene" type="Node2D"] @@ -36,19 +65,83 @@ texture = ExtResource( 2 ) script = ExtResource( 1 ) [node name="Spot" parent="." instance=ExtResource( 4 )] -position = Vector2( 192, 256 ) +position = Vector2( 184, 472 ) [node name="Spot2" parent="." instance=ExtResource( 4 )] -position = Vector2( 192, 64 ) +position = Vector2( 768, 512 ) [node name="Spot3" parent="." instance=ExtResource( 4 )] position = Vector2( 832, 192 ) [node name="PersonRoot" parent="." instance=ExtResource( 3 )] position = Vector2( 304, 408 ) +description_untyped = SubResource( 1 ) [node name="PersonRoot2" parent="." instance=ExtResource( 3 )] position = Vector2( 456, 448 ) [node name="PersonRoot3" parent="." instance=ExtResource( 3 )] position = Vector2( 616, 272 ) + +[node name="DescriptionPane" type="Control" parent="."] +margin_left = -320.0 +margin_right = 320.0 +margin_bottom = 136.0 +script = ExtResource( 7 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="PanelContainer" type="PanelContainer" parent="DescriptionPane"] +margin_right = 320.0 +margin_bottom = 152.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="NameLabel" type="Label" parent="DescriptionPane"] +margin_left = 72.0 +margin_top = 8.0 +margin_right = 296.0 +margin_bottom = 28.0 +custom_fonts/font = ExtResource( 6 ) +text = "Jean machine duchapelin" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="TitleLabel" type="Label" parent="DescriptionPane"] +margin_left = 80.0 +margin_top = 32.0 +margin_right = 304.0 +margin_bottom = 52.0 +custom_fonts/font = ExtResource( 6 ) +text = "Grandma" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Descriptions" type="Label" parent="DescriptionPane"] +margin_left = 16.0 +margin_top = 72.0 +margin_right = 312.0 +margin_bottom = 144.0 +custom_fonts/font = ExtResource( 6 ) +text = "- Likey likey +- Hatey Hatey +- Isey Isey +- Swearey sweary" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Portrait" type="TextureRect" parent="DescriptionPane"] +margin_left = 8.0 +margin_top = 8.0 +margin_right = 64.0 +margin_bottom = 64.0 +texture = ExtResource( 5 ) +stretch_mode = 5 +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/Scripts/Description.gd b/Scripts/Description.gd new file mode 100644 index 0000000..cfc9f6b --- /dev/null +++ b/Scripts/Description.gd @@ -0,0 +1,23 @@ +extends Resource + +class_name Description + +export var name : String +export var subtitle : String +export var portrait : Texture +export var traits: Array + +func getTraitString() -> String: + var result = "" + for trait in traits: + result += "- " + result += trait.string + result += "\n" + return result + +func checkTraits(trait_owner) -> bool: + for u_trait in traits: + var trait : Trait = u_trait + if trait.validate(trait_owner) == false: + return false + return true diff --git a/Scripts/DescriptionPane.gd b/Scripts/DescriptionPane.gd new file mode 100644 index 0000000..2fb34b9 --- /dev/null +++ b/Scripts/DescriptionPane.gd @@ -0,0 +1,40 @@ +extends Control + +class_name DescriptionPane + +onready var NameLabel : Label = $NameLabel +onready var TitleLabel : Label = $TitleLabel +onready var DescriptionsLabel : Label = $Descriptions +onready var Portrait : TextureRect = $Portrait + +#func _ready(): +# test() +# +#func test(): +# while true: +# yield(get_tree().create_timer(2), "timeout") +# show() +# yield(get_tree().create_timer(2), "timeout") +# hide() + +func easeInOutQuart(x: float): + return 8 * x * x * x * x if x < 0.5 else 1 - pow(-2 * x + 2, 4) / 2 + +func fill(name: String, title: String, description: String, portrait : Resource = null): + NameLabel.text = name + TitleLabel.text = title + DescriptionsLabel.text = description + +func show(): + easeInEaseOut(Vector2.ZERO) + +func hide(): + easeInEaseOut(Vector2(-self.margin_right, 0)) + +func easeInEaseOut(final_pos: Vector2): + var start_pos = Vector2(self.margin_left, self.margin_top) + var delta = 0 + while delta <= 1: + yield(get_tree(), "idle_frame") + delta += get_process_delta_time() + self.margin_left = lerp(start_pos.x, final_pos.x, easeInOutQuart(delta)) diff --git a/Scripts/PersonBody.gd b/Scripts/PersonBody.gd index e7ee39d..a1b294e 100644 --- a/Scripts/PersonBody.gd +++ b/Scripts/PersonBody.gd @@ -3,29 +3,49 @@ extends KinematicBody2D class_name PersonBody onready var person : PersonRoot = get_parent() +onready var sprite : AnimatedSprite = $PersonSprite +var hover = false var held = false var in_spot = false func pickup(): + hover = false held = true #change cursor to clenched hand func drop(): held = false - move_and_slide(Vector2(randi() % 2 - 1, randi() %2 - 1), Vector2.UP) + hover = true + # ensure collisions to avoid stacking persons +# warning-ignore:return_value_discarded + move_and_slide(Vector2.ZERO, Vector2.UP) + # apply the collision movement back to the root of the person person.global_position += position position = Vector2.ZERO #change cursor to idle hand -func _input_event(viewport: Object, event: InputEvent, shape_idx: int): +func _input_event(_viewport: Object, event: InputEvent, _shape_idx: int): if event is InputEventMouseButton: if event.button_index == BUTTON_LEFT and event.pressed: pickup() elif held and event.button_index == BUTTON_LEFT and !event.pressed: drop() - + func _physics_process(_delta): if held: person.global_transform.origin = get_global_mouse_position() +func _process(_delta): + return +# warning-ignore:unreachable_code + if hover: + sprite.self_modulate = Color(randf(),randf(),randf(), 1) + +func onMouseEnter(): + hover = true + person.start_display() + +func onMouseLeft(): + hover = false + person.stop_display() diff --git a/Scripts/PersonRoot.gd b/Scripts/PersonRoot.gd index 2adfe17..d1e9e79 100644 --- a/Scripts/PersonRoot.gd +++ b/Scripts/PersonRoot.gd @@ -2,6 +2,9 @@ extends Node2D class_name PersonRoot +export var description_untyped : Resource +var description : Description +var descriptionPane : DescriptionPane #onready var body : PersonBody = $PersonBody # Declare member variables here. Examples: @@ -11,8 +14,19 @@ class_name PersonRoot # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. + description = description_untyped + descriptionPane = get_parent().get_node("DescriptionPane") + pass +func start_display(): + descriptionPane.fill(description.name, description.subtitle, description.getTraitString()) + descriptionPane.show() + +func stop_display(): + descriptionPane.hide() + +func check_traits() -> bool: + return description.check_traits(self) # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): diff --git a/Scripts/SpotArea.gd b/Scripts/SpotArea.gd index 1f52d63..fc041ad 100644 --- a/Scripts/SpotArea.gd +++ b/Scripts/SpotArea.gd @@ -1,21 +1,24 @@ extends Area2D +signal spotChanged + onready var spot : Spot = get_node("../..") var current_bod: PersonBody = null var bod_in = false func onBodyEnter(body: Node): - print_debug("bod enters") current_bod = body -func onBodyLeft(body: Node): - print_debug("bod leaves.") +func onBodyLeft(_body: Node): current_bod = null func _process(_delta): if bod_in == false and current_bod != null and !current_bod.held: center_bod() + emit_signal("spotChanged") + else if bod_in == true and current_bod == null: + emit_signal("spotChanged") bod_in = !current_bod.held if current_bod != null else false if current_bod: current_bod.in_spot = bod_in @@ -23,5 +26,4 @@ func _process(_delta): func center_bod(): var root : PersonRoot = current_bod.get_parent() - print_debug("root position = ", root.global_position) root.position = spot.position diff --git a/Scripts/SpotManager.gd b/Scripts/SpotManager.gd index bbdb2c2..b60fab5 100644 --- a/Scripts/SpotManager.gd +++ b/Scripts/SpotManager.gd @@ -4,9 +4,17 @@ var spots : Array func _ready(): spots = get_tree().get_nodes_in_group("spot") + self.connect("spotChanged", self, "onAnySpotChanged") -func _process(delta): +func _process(_delta): for spot in spots: if spot.person == null: return get_tree().quit() + +func onAnySpotChanged(): + for u_spot in spots: + var spot : Spot = u_spot + if spot.person.check_traits() == false: + return + get_tree().quit() diff --git a/Scripts/Trait.gd b/Scripts/Trait.gd new file mode 100644 index 0000000..742c2d8 --- /dev/null +++ b/Scripts/Trait.gd @@ -0,0 +1,30 @@ +extends Resource + +class_name Trait + +enum TraitType{ + MUNDANE, + EXCLUSIONARY, + REQUIRES +} + +export var id: String +export var string: String +export(TraitType) var type #TraitType + +func validate(trait_owner) -> bool: + match type: + TraitType.MUNDANE: + return true + TraitType.EXCLUSIONARY: + return excludes(trait_owner) + TraitType.REQUIRES: + return requires(trait_owner) + return false + +func excludes(_trait_owner) -> bool: + return false + +func requires(_trait_owner) -> bool: + return false + diff --git a/TemplateCustomResources/description.tres b/TemplateCustomResources/description.tres new file mode 100644 index 0000000..2699934 --- /dev/null +++ b/TemplateCustomResources/description.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" load_steps=2 format=2] + +[ext_resource path="res://Scripts/Description.gd" type="Script" id=1] + +[resource] +script = ExtResource( 1 ) +name = "" +subtitle = "" +traits = [ ] diff --git a/TemplateCustomResources/trait.tres b/TemplateCustomResources/trait.tres new file mode 100644 index 0000000..239e2d1 --- /dev/null +++ b/TemplateCustomResources/trait.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" load_steps=2 format=2] + +[ext_resource path="res://Scripts/Trait.gd" type="Script" id=1] + +[resource] +script = ExtResource( 1 ) +id = "" +string = "" +type = 0 diff --git a/Text/how.txt b/Text/how.txt index e69de29..28b46af 100644 --- a/Text/how.txt +++ b/Text/how.txt @@ -0,0 +1,14 @@ +Les types de traits: + - Les traits "lore", explicatifs, qui décrivent le PNJ: "Is" something + - Les traits "like/hate", qui requièrent un certain type ou l'absence d'un type chez le voisin. + - 30% du temps, ça doit être clairement explicite: un "HateCat" ne voudra pas de chat. + - Le reste du temps, ça peut être + subtil: un "HateNoise" n'aimera ni avoir un DJ, ni avoir un Bébé + - Ou un "LikePipe" appréciera la compagnie soit d'un Hipster, soit d'un Grandpa. + Pas nécessaire d'avoir les deux: alors qu'un trait Hate est plus exclusif (c'est un peu l'idée aussi.) +En terme de quantités: + 60 traits de "Is", + 15 traits "Like évident", + 10 traits "Hate évident", + 30 traits "Like ""subtil""", + 30 traits "Hate ""subtil""", += environ 150 traits individuels haha je suis un débile :,) bla bla l'explosion combinatoire hein oui oui hugo diff --git a/Text/todo.txt b/Text/todo.txt index 2937a64..d140ee4 100644 --- a/Text/todo.txt +++ b/Text/todo.txt @@ -2,17 +2,17 @@ - Make it so people can be put and snapped into Spots - Make it so Spots link themselves automatically when in a scene - Make Spots react to people being in -Make SpotManager win when all spots are filled - ~ break ~ -Make people have characteristics -Display characteristics on mouseover -Make some characteristics hate other characteristics, rendering spots invalid -Make SpotManager win when all spots are valid -Create lotsa characteristics for fun -Create a people randomizer -Create a level solver -Create some levels, ramping up the nmbr of people and spots, adding unnecessary ppl, etc -Polish: -Make people move around idly -Make some art for people -make some art for levels + - Make SpotManager win when all spots are filled + ~ break from 16:30 to 18:00~ + - Make people have traits + - Display traits on mouseover + - Make some traits hate other traits, rendering spots invalid + - Make SpotManager win when all spots are valid +Let's back-off from the original approach and go in a more incremental way +Toy-ishness is an important component, so now that I have a rough way of making levels, let's get at it directly +- Marriage dinner table (family-themed) + - Zoo (animal-themed) +- Demon summoning (all the same skins) +If I get those 3 levels with aplenty of details, i'll be happy. +but polish polish and polish ! +Maybe a 4th level that will serve as a tutorial, while those 3 other will have a LOT of characters. diff --git a/Text/traits.csv b/Text/traits.csv new file mode 100644 index 0000000..cff7432 --- /dev/null +++ b/Text/traits.csv @@ -0,0 +1,11 @@ +TraitName;TraitString;ExcludedNeighbors;RequiredNeighbors +LikeCat;Patate!;;IsCat +LikeChocolate;;;IsGrandma +HatePeanut;;; +HateHats;;IsHipster; +LikePipe;;;IsGrandpa, IsHipster +LikeHipster;;; +IsCat;;; +IsHipster;;; +IsGrandma;;; +IsGrandpa;;; diff --git a/Text/traits.csv.import b/Text/traits.csv.import new file mode 100644 index 0000000..98f02a1 --- /dev/null +++ b/Text/traits.csv.import @@ -0,0 +1,13 @@ +[remap] + +importer="csv_translation" +type="Translation" +valid=false + +[deps] + +source_file="res://Text/traits.csv" +[params] + +compress=true +delimiter=0 diff --git a/addons/file-editor/lastopenedfiles.lastcfg b/addons/file-editor/lastopenedfiles.lastcfg index 595eb05..57aac8b 100644 --- a/addons/file-editor/lastopenedfiles.lastcfg +++ b/addons/file-editor/lastopenedfiles.lastcfg @@ -3,3 +3,4 @@ what.txt="res://Text/what.txt" how.txt="res://Text/how.txt" todo.txt="res://Text/todo.txt" +traits.csv="res://Text/traits.csv" diff --git a/project.godot b/project.godot index 0ab1532..ae78112 100644 --- a/project.godot +++ b/project.godot @@ -14,6 +14,16 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://addons/file-editor/scripts/CSVEditor.gd" }, { +"base": "Resource", +"class": "Description", +"language": "GDScript", +"path": "res://Scripts/Description.gd" +}, { +"base": "Control", +"class": "DescriptionPane", +"language": "GDScript", +"path": "res://Scripts/DescriptionPane.gd" +}, { "base": "HTTPRequest", "class": "GoogleTranslateAPI", "language": "GDScript", @@ -33,13 +43,21 @@ _global_script_classes=[ { "class": "Spot", "language": "GDScript", "path": "res://Scripts/Spot.gd" +}, { +"base": "Resource", +"class": "Trait", +"language": "GDScript", +"path": "res://Scripts/Trait.gd" } ] _global_script_class_icons={ "CSVEditor": "", +"Description": "", +"DescriptionPane": "", "GoogleTranslateAPI": "", "PersonBody": "", "PersonRoot": "", -"Spot": "" +"Spot": "", +"Trait": "" } [application]