Skip to content

Commit 867dfcd

Browse files
committed
implemented scribble for mind read bubbles
1 parent a9e7e9f commit 867dfcd

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

objects/obj_game/Draw_64.gml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,22 @@ for (var i = array_length(self.thought_bubbles) - 1; i >= 0; i--) {
1111
var max_speech_bubble_width = 480;
1212
var speech_bubble_padding = 32;
1313

14-
var ww = string_width_ext(bubble.text, -1, max_speech_bubble_width - speech_bubble_padding);
15-
var hh = string_height_ext(bubble.text, -1, max_speech_bubble_width - speech_bubble_padding) + speech_bubble_padding;
16-
17-
ww = ceil(ww / 32) * 32;
18-
hh = ceil(hh / 32) * 32;
19-
20-
draw_sprite_stretched(bubble.parent.mind_read_sprite, bubble.parent.mind_read_sprite_index, location.x - ww / 2 , location.y - hh, ww, hh);
21-
22-
draw_set_halign(fa_center);
23-
draw_set_valign(fa_middle);
24-
25-
draw_set_colour(c_black);
26-
27-
scribble(bubble.text)
14+
var scrib = scribble(bubble.text)
2815
.starting_format("fnt_game", c_white)
2916
.sdf_border(c_black, 2)
3017
.sdf_shadow(c_black, 0.5, 1, 1)
3118
.scale(.4)
32-
.wrap(ww - speech_bubble_padding)
33-
.align(fa_center, fa_middle)
34-
.draw(location.x, location.y - hh / 2);
19+
.wrap(max_speech_bubble_width - speech_bubble_padding)
20+
.align(fa_center, fa_middle);
21+
22+
23+
var ww = scrib.get_width() + speech_bubble_padding;
24+
var hh = scrib.get_height() + speech_bubble_padding;
3525

36-
//draw_text_ext(location.x, location.y - hh / 2, string_copy(bubble.text, 1, bubble.text_index), -1, ww - speech_bubble_padding);
26+
ww = ceil(ww / 32) * 32;
27+
hh = ceil(hh / 32) * 32;
3728

29+
draw_sprite_stretched(bubble.parent.mind_read_sprite, bubble.parent.mind_read_sprite_index, location.x - ww / 2 , location.y - hh, ww, hh);
3830

31+
scrib.draw(location.x, location.y - hh / 2, bubble.typist);
3932
}

scripts/Group_Thought_Bubbles/Group_Thought_Bubbles.gml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ function ThoughtBubble(text, time_to_live, parent) constructor {
22
self.text = text;
33
self.time_to_live = time_to_live;
44
self.parent = parent;
5+
self.typist = scribble_typist();
6+
self.typist.in(1, 2);
57

68
self.text_index = 0;
79

0 commit comments

Comments
 (0)