Text with sound

I

InsetCoffee

Guest
how do you put sound with text, for example if I want to have a sound that played with each letter?
 

obscene

Member
audio_play_sound().

The question is how are you drawing your letters. If you can draw a letter, you can make a sound.
 

Roa

Member
with each letter what? Clicked? Highlighted? Type in a keyboard string? Printed one by one to the screen? When @ slays D ? You're going to have to be a little less ambiguous than that.
 
I

InsetCoffee

Guest
like if I had a npc with a text box that was taking to the player. I want a small sound to play with each of the letters as there drawn.
 
T

Tonydaderp

Guest
If (drawing text){
audio_play_sound(blah,blah,blah)
}
 

obscene

Member
If you've got that, you've done the hard part. Wherever you tell it to add a letter, use audio_play_sound() to play a sound. We can't tell you much more than that.
 
I

InsetCoffee

Guest
ok let it be noted I'm new to coding so define one letter at a time.
 

rIKmAN

Member
Do you want the letters to be drawn one letter at a time?

Some games show text inside the dialogue box (3 lines or whatever) and then shows the next 3 lines on a button press until there is no text left. While this is happening it will play a "wahwahnahnahwahwah" sound to simulate talking.

Some do it using a typewriter "one letter at a time" style, where each letter is drawn one after the other, which is a bit more difficult to achieve but totally doable.

There are many ways to do it, but it depends what you are aiming for in your game.

There are probably some free assets on the marketplace (here is one) that do just this if you don't want to do it yourself or are new to GM, but be warned that you won't learn as quickly using this method, and some of the assets may be a bit difficult to understand if you are new to GM or programming.

If you are new I would recommend reading up on the string functions and seeing if you can code up a small example which takes a sentence and prints it out like a typewriter.

Baby steps!
 
I

InsetCoffee

Guest
I thick what I want is one letter at a time. do you know a game called Undertale?
 

rIKmAN

Member
I thick what I want is one letter at a time. do you know a game call Undertale?
I've heard of it but never played it, but I know what a typewriter effect is :)

You sound like you might be new to programming, so I think it might be worth you following a few tutorials to give you a grasp of the basics before you start trying to tackle things that will eventually make you give up through frustration.

There are some good playlists for GM tutorials here, and although they may not be the type of game you ideally want to make, they will give you a good solid grasp of the basics of making a game that you can then use to work towards the game you really want to make.

Like I said, baby steps - you don't build a house without first learning how to lay a brick! :)
 
I

InsetCoffee

Guest
I've watched those tutorials and I have a basics understanding of coding except for text . but I've be working on it all day and I'm tired so I'm done for the day. thank you for all the help
 
T

tserek

Guest
Here's a quick version of textbox (GM8) with sound, basically that's what you need?

create:
Code:
text = "how do you put sound with text, for example if I want to have a sound that played with each letter?";
ctr = 0;
box_width = 480;
draw:
Code:
if ctr <= string_length(text)
{
 if string_copy(text,ctr,1) !=" " {sound_play(snd_text);}
 ctr+=1;
}

draw_text_ext(x,y,string_copy(text,1,ctr),-1,box_width);
 
Last edited by a moderator:
Top