Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Information about object: obj_ui_storyText
//====
Create Event:
execute code:
//====
typed_letters = 0; //for typewriter effect (one letter at a time)
i=0
show=true
text[0,0]='1st part of text'
text[0,1]='2nd part of text'
text[0,2]='3rd part of text'
text[0,3]=''
text[1,1]='another 1st part of text'
text[1,2]='etc...'
text[1,3]=''
//make the last msg be equal to '' to end the messages
txtPart = 0;
txtSel = 0; //when I create this object I set this var to the textblocks I want to show (-> with(instance create(0,0,obj_ui_storyText) { txtSel = 1; } <-that is how I create it)
nxtBtnX = 400; //this is the position of the 'NEXT' sprite
nxtBtnY = 200;
nxtBtnAlpha = 0;
//====
Alarm Event for alarm 0:
execute code:
//====
if (typed_letters < string_length(text[txtSel,i])) //this loops untill all letters are typed
{
alarm[0] = type_speed*room_speed;
typed_letters++;
audio_play_sound(snd_ui_button_tick,2,false);
}
else alarm[1] = 4*room_speed; //when its done it triggers alarm[1] after 4 secconds
//====
Alarm Event for alarm 1:
execute code:
//====
typed_letters = 0;
show=false;
instance_destroy(); //this destroys the textbox
//====
Step Event:
execute code:
//====
if (nxtBtnAlpha < 1) //this just fades in the 'NEXT' sprite
{
nxtBtnAlpha += 0.025;
}
//here comes the control for going to the next part of the text
var kContinue;
kContinue = keyboard_check_pressed(vk_space);
if (kContinue)
{
typed_letters = 0;
if (text[txtSel,i]!=''){i+=1;show=true; nxtBtnAlpha = 0;}
if (text[txtSel,i]='')
{
show=false;
}
}
//====
Draw Event: //If you want to use a box like this with a moving view (ingame) then better use a drawGUI event...
execute code:
//====
draw_sprite_ext(spr_ui_txtBoxNextIcon, 0, nxtBtnX, nxtBtnY, 1,1,0,c_white, nxtBtnAlpha); //draws the 'NEXT' sprite
draw_text_ext(x, y, string_copy(text[txtPart,txtSel], 0, typed_letters),14,390); //draws the text
================EOF
Hope that helps a little?!