-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode_planning.txt
108 lines (82 loc) · 4.47 KB
/
code_planning.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
One single script for Enter() and Leave() functions, same script could
be applied to each character as long as each character parent has unique animations
The sprites below will all share the same walking animation.
Dialogue system
===============
Think for a single character:
He will come in at certain times. He might decide to come back based on how
you treated him earlier, or he might come back at predefined times regardless.
He might say something to you, and based on how you respond, he may decide to leave.
1. Assume that only 1 character is ever talking to you at the same time.
He would initiate a short "conversation", which would contain
1. what he says
2. my choices for responding
3. how he would react to those choices
* (leave, stay, leave later, come back at some point later)
* but how do we program those choices?
* leave later (a simple coroutine that sleeps until a certain time then leaves)
* come back (could toggle a variable that is used to decide whether to come
back near the end)
SIMPLE DIALOGUE SOLUTION:
----------------
Set of couroutines in a separate script for each character, where each
coroutine represents a single short conversation (character says something,
then maybe another thing, then the player has a prompt to respond somehow)
For now, use console.logs to output what the characters say, and what
the prompt is for the main player. make a basic conversation:
1. a character comes in at a certain time
2. He says something (via Debug.Log)
3. Main player has two choices to respond (sees his choices via Debug.Log). He
can pick a choice by pressing either A or B on his keyboard. After a certain
amount of time, default to choosing a specific choice.
4. One of those choices prompts the character to say something, then he leaves.
5. But another one of those choices makes the character happy, and he stays.
DIALOGUE DRAW SOLUTION:
-----------------------
CharacterDialogueBubble class, which can be instantiated with pointers to a dialogue box
object and a text object. So then the script itself will just directly set the text
via Say(text). MakeVisible() and Hide() will hide and show the canvas
that specifies where on the map text shows from the Bubble.
Functions:
Say(text)
MakeVisible()
Hide()
Each Dialogue script per character will utilize their own CharacterDialogueBubble
object, to manage what they say.
USER PROMPT SOLUTION:
---------------------
A simple UserPrompt class, singleton pattern (we just attach it to a singleton that
all the character objects can reference, or findByName whatever's easiest)
functions:
Say(text) -> Just says something with no prompt
GivePrompt(prompt text, timeToAnswer, defaultOption, optionA, optionB) ->
returns a letter 'a' or 'b' depending on how the user chooses, for
this game we'll start by just using the keyboard to press a or b,
we'll figure out a way to detect the press inside the giveprompt function
(maybe from within Update and we set a variable and causes givePrompt to close)
GivePrompt is a synchrounous function, it won't return until time limit
is up or user chooses. Time limit 7 seconds for now.
For now, when an option is chosen, do nothing, just hide away the prompt.
TODO stretch goal: Hide prompt, then type out black speech bubble. Or just
have the text type back out in the prompt box.
The dialogue script for each character will utilize the UserPrompt class inline with
the CharacterDialogueBubble class, because the conversation would be inline.
Music Manager System
--------------------
You have an array of layers, where each layer is an instrument playing in the song.
Each sound is muted at the beginning. When a player enters, AFTER he sits down his music
begins playing.
So we have a simple system to mute and unmute the different tracks by index.
TODO/STRETCH goals: Make an instrument louder than the rest when he initially enters
Rank/Order of Tasks
-------------------
* Reusable script for entering and leaving for different characters
* Same script for each character, however the animations "inside" and "outside" will
be different.
* Simple Dialogue System (Use console.log for now, replace with actual draw calls
later.)
* MusicScript (possibly, still need to plan this, would likely just pair a track to each
character, if character out of frame then mute that track, if in then unmute).
* BASICS DONE. CharacterDialogueBubble
* BASICS DONE. UserPrompt
* BASICS DONE. Drawing system for dialogue bubbles