Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add.messages #15

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c983162
MessageBoxes instanciable + text size adaptation
sebferrer Nov 2, 2018
f2f8746
Oops, remove useless file
sebferrer Nov 2, 2018
066abe1
MessageBox scrolling
sebferrer Nov 3, 2018
56cb80b
cleanup
bastienguillon Feb 4, 2019
cbe5f71
draw characters one by one
bastienguillon Feb 5, 2019
c304440
add shaky messages animation
bastienguillon Feb 5, 2019
b1a548b
handle choices and select them + handle closing dialog
bastienguillon Feb 6, 2019
31ee4c3
small fix
bastienguillon Feb 6, 2019
0baf67a
tweaking
bastienguillon Feb 6, 2019
19f3c2b
Animation factor directly included in IDialogAnimation
sebferrer Feb 6, 2019
010288d
TOEIC: 780
sebferrer Feb 6, 2019
55b050a
Blur audio button on click
sebferrer Feb 6, 2019
79a8692
fix dialog answers animation
Feb 8, 2019
12d6a06
Add pause system
sebferrer Feb 10, 2019
313a832
Messages are no more requiring _line_width_in_characters and Monospac…
sebferrer Feb 11, 2019
8e815a6
Add 3 glitchy effects (spinny, splitted, uppercase)
sebferrer Feb 11, 2019
d0f5d61
upgrade gulp 3 --> 4
sebferrer Apr 20, 2021
69d77c3
entities height perspective + WIP actionable objects
sebferrer Apr 21, 2021
47a8663
[WIP] actionable objects
sebferrer Apr 21, 2021
38aa953
actionable entities linked to floor + room
sebferrer Apr 22, 2021
ee76000
spread entities
sebferrer Apr 22, 2021
bfdf7d8
entities - floor/room link
sebferrer Apr 22, 2021
8b46094
actionable entities in a separate file
sebferrer Apr 23, 2021
3af06d0
drawable entities + [WIP] rocks
sebferrer Apr 26, 2021
b3944e0
[WIP] spread entities + random locations
sebferrer Apr 29, 2021
14e9a3f
spread entities + random locations --> some improvements
sebferrer Apr 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions src/messages/dialog_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,27 @@ export function get_animation(node: IDialogNode): DialogAnimation {
}

export function get_animation_factor(node: IDialogNode): number {
return node.animation != null ? node.animation.factor : 0;
return node.animation != null && node.animation.factor != null ? node.animation.factor : 0;
}

export const sample_dialog = <IDialogNode>{
message: "Shrubberies are my trade. I am a shrubber.",
next_node: <IDialogNode>{
message: "My name is Roger the Shrubber. I arrange, design, and sell shrubberies.",
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 4},
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 4 },
next_node: <IQuestionNode>{
message: "Are you saying Ni to that old woman?",
answers: [
{
message: "Um, yes.",
animation: <IDialogAnimation>{ type: DialogAnimation.None },
animation_factor: 0,
animation: { type: DialogAnimation.None },
Copy link
Owner Author

@sebferrer sebferrer Feb 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi virer le <DialogAnimation alors que tu le laisses sur les autres ?

next_node: <IDialogNode>{
message: "Oh, what sad times are these when passing ruffians can say Ni at will to old ladies."
}
},
{
message: "Ni!",
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 4},
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 4 },
next_node: <IDialogNode>{
message: "There is a pestilence upon this land, nothing is sacred. Even those who arrange and design shrubberies are under considerable economic stress in this period in history."
}
Expand All @@ -72,28 +71,28 @@ export const angry_dialog = <IDialogNode>{
message: "Hello there! How are you? ^_^",
next_node: <IDialogNode>{
message: "Why don't you answer me...?",
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 2},
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 2 },
next_node: <IDialogNode>{
message: "Please stop ignoring me...",
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 4},
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 4 },
next_node: <IDialogNode>{
message: "Don't you think I've already suffered enough? Do you even know what I've been through until now?",
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 6},
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 6 },
next_node: <IDialogNode>{
message: "Oh sure! Keep not answering! After all, you're smarter than everyone! You're above EVERYTHING",
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 8},
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 8 },
next_node: <IDialogNode>{
message: "HEY, I'M TALKING TO YOU, YOU BRAT",
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 10},
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 10 },
next_node: <IDialogNode>{
message: "I'm so angry that my text starts to shakea bit too much right now...",
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 15},
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 15 },
next_node: <IDialogNode>{
message: "But after all, you're right... In this world. it's kill or to be killed.",
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 20},
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 20 },
next_node: <IDialogNode>{
message: "Anyway, stop playing Cloud at Smash Bros, you fucking noob!",
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 100}
animation: <IDialogAnimation>{ type: DialogAnimation.Shaky, factor: 100 }
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/messages/message_box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Direction } from "../enum";
export class MessageBox {

/** Number of characters per line */
private static readonly _line_width_in_characters = 49;
private static readonly _line_width_in_characters = 48;
/** Bottom margin, so that the text is not stuck to the bottom of the message box */
private static readonly _bottom_margin = 20;
private static readonly DOM_ID = "message-box";
Expand Down Expand Up @@ -178,16 +178,16 @@ export class MessageBox {
for (let character_index = 0; character_index < text.length; ++character_index) {
this._context.fillText(
text[character_index],
this.get_character_x_offset(character_index) + MathUtil.get_random_int(get_animation_factor(this._current_node)),
this.get_character_y_offset(i + 1 + this._current_line_index) + MathUtil.get_random_int(get_animation_factor(this._current_node))
this.get_character_x_offset(character_index) + MathUtil.get_random_int(get_animation_factor(current_choice)),
this.get_character_y_offset(i + 1 + this._current_line_index) + MathUtil.get_random_int(get_animation_factor(current_choice))
);
}
break;
}
}
}

/**
/**
* Prepares the MessageBox to display the given node
*/
private load_node(node: IDialogNode) {
Expand Down