Dear GameMaker Community, I have been working a dialogue system for quite sometime now and everything is going exactly as expected. However, there is an issue that I have dealing with that cannot figure out I intend to draw a profile picture that animate lip movement so in the draw event I set the sub-image to -1 but it does not animate. I have tried sprite_exist in the step event to set the image_speed but it does not work. I am currently stumped by the particular situation.
It should be noted that the dialogue system uses two objects to work, I will post the events for both objects for better clarity:
obj_signpost: Create Event (Please ignore scr_profile_picture_array its just a library of sprite pictures)
obj_signpost: Step Event
obj_textbox: Create Event (The first two variables are placeholders in case of a missing array number)
obj_textbox: Step Event (Here you can see my poor man attempt to animate the profile sprite)
obj_textbox: Draw Event
It should be noted that the dialogue system uses two objects to work, I will post the events for both objects for better clarity:
obj_signpost: Create Event (Please ignore scr_profile_picture_array its just a library of sprite pictures)
Code:
//Profile Picture Array
scr_profile_picture_array()
//My Textbox
MyTextbox = noone;
//Text Array
Mytext[0] = "This is a sign.";
Mytext[1] = "No 💩💩💩💩 Sherlock!";
//Profile Array
Myprofile[0] = Sign_Profile;
Myprofile[1] = Durga_Profile_Halfclosed;
Code:
if place_meeting(x, y, obj_player)
{
if keyboard_check_pressed(ord('X'))
{
if MyTextbox = noone
{
MyTextbox = instance_create(view_xview[0], view_yview[0], obj_textbox);
MyTextbox.text = Mytext;
MyTextbox.profile = Myprofile;
MyTextbox.creator = self;
}
}
}
else
//Removing Signs and symbols when not touching the sign (Reset the Varibles).
{
if MyTextbox != noone
{
instance_destroy(MyTextbox)
MyTextbox = noone;
}
}
Code:
//Initalize Varibles
text = "Mary had a little lamb who fleece was white as snow. La Lei Lu Lei Lo";
profile = spr_Almas_profile;
//Text Positioning
Box_width = sprite_get_width(spr_textbox);
String_height = string_height(text);
charCount = 0;
//Pages
page = 0;
//Creator
creator = noone;
Code:
//Interact button
if keyboard_check_pressed(ord('X'))
{
if (page + 1 < array_length_1d(text) && array_length_1d(profile))
{
page += 1;
charCount = 0;
}
else
{
instance_destroy();
creator.alarm[0] = 1;
}
}
if sprite_exists(profile[page])
{
image_speed = 0.5;
}
else
{
image_speed = 0;
}
Code:
//Creating Textbox
draw_sprite(spr_textbox, 0, view_xview[0] + 128, view_yview[0] + 25);
//Creating Text
draw_set_font(txt_font_1);
if (charCount < string_length(text[page]))
{
charCount += 0.50;
}
TextPart = string_copy(text[page], 1, charCount)
draw_text_ext(view_xview[0] + 5, view_yview[0] + 5, TextPart, String_height, Box_width);
//Creating Portrait
draw_sprite(profile[page],-1,view_xview[0] + 32,view_yview[0] + 85);