systems working, kindaa ready for LD and plenty of polish tomorrow

This commit is contained in:
Hurlu 2021-06-12 22:52:01 +02:00
parent 76a67b38fb
commit fa083f3d55
25 changed files with 380 additions and 31 deletions

View File

@ -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 )

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Graphics/interrogation.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -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

View File

@ -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"]

View File

@ -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
}

23
Scripts/Description.gd Normal file
View File

@ -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

View File

@ -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))

View File

@ -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()

View File

@ -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):

View File

@ -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

View File

@ -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()

30
Scripts/Trait.gd Normal file
View File

@ -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

View File

@ -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 = [ ]

View File

@ -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

View File

@ -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

View File

@ -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.

11
Text/traits.csv Normal file
View File

@ -0,0 +1,11 @@
TraitName;TraitString;ExcludedNeighbors;RequiredNeighbors
LikeCat;Patate!;;IsCat
LikeChocolate;;;IsGrandma
HatePeanut;;;
HateHats;;IsHipster;
LikePipe;;;IsGrandpa, IsHipster
LikeHipster;;;
IsCat;;;
IsHipster;;;
IsGrandma;;;
IsGrandpa;;;
1 TraitName TraitString ExcludedNeighbors RequiredNeighbors
2 LikeCat Patate! IsCat
3 LikeChocolate IsGrandma
4 HatePeanut
5 HateHats IsHipster
6 LikePipe IsGrandpa, IsHipster
7 LikeHipster
8 IsCat
9 IsHipster
10 IsGrandma
11 IsGrandpa

13
Text/traits.csv.import Normal file
View File

@ -0,0 +1,13 @@
[remap]
importer="csv_translation"
type="Translation"
valid=false
[deps]
source_file="res://Text/traits.csv"
[params]
compress=true
delimiter=0

View File

@ -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"

View File

@ -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]