• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

GMS 2 floor_get_random() only available in game maker studio 1.4 how to achieve in studio 2 please help

F

Falconsoft-Industries

Guest
So I want to know how to wait 3 seconds after
if keyboard_check(vk_space)
{
index++
}
Before playing the tping sound effect, how would I go about achieving this, and this is all in the draw event.
 
F

Falconsoft-Industries

Guest
Could you give me a example in code of how to use this function?
 
F

Falconsoft-Industries

Guest
So for what I need you’re suggesting is
if floor(random(3 * room_speed))
{
audio_play_sound(sfx_typing,100,1)
}
Correct?

Well I will give it a try, and if it doesn’t work well back to the drawing board otherwise close this topic if I reply saying “it worked” and only then okay please and thank you.
 
Last edited by a moderator:
So I want to know how to wait 3 seconds after
if keyboard_check(vk_space)
{
index++
}
Before playing the tping sound effect, how would I go about achieving this, and this is all in the draw event.
there are several ways to answer your question, the way i would do it is ...

in the "Create Event" create a variable
Code:
Timer = room_speed * 3 ;
in the "Draw Event"
Code:
if Timer != room_speed * 3
{
    Timer--
    if Timer == 0
    {
        Timer = room_speed * 3
        // insert Audio Code Here !!
    }
}

if  keyboard_check(vk_space) == true &&
    Timer == room_speed * 3
{
    index++
    Timer--
}
So...
checking if the space bar is / has been pressed
as well as checking if the timer is at the 3 second mark
will limit the ability of the system Acknowledging the space bar being pressed until the 3 seconds are up.
 
Last edited:
floor_get_random() only available in game maker studio 1.4 how to achieve in studio 2 please help
There is no such command in GMS1.4 or GMS2. Not sure where you are getting your information from, but you should check the manual first (and that can be done online) for what commands you are really wanting to use.
GMS1.x manual: https://docs.yoyogames.com/
GMS2.x manual: https://docs2.yoyogames.com/

It did not work.
How did it not work? Did you get an error? What happens when you put in all the provided code?
Can you explain (perhaps without showing any code, as it appears that may be confusing to everyone if it is not related to what you want) what you are trying to do?

 
F

Falconsoft-Industries

Guest
Never mind I figured it out. If anyone wants to know how just pm me and I will send them the code.

Okay in the Obj_controller object I used this code

Room start event:
audio_stop_all()
alarm[0]=8

Alarm 0 event:
audio_play_sound(sfx_tick,100,1)
alarm[1]=8

Alarm 1 event:
audio_stop_all()
alarm[0]=8

Room end event:
audio_stop_all()

Destroy event:
audio_stop_all()

Also the object Obj_controller is always placed in the same room containing a message box object
 
Last edited by a moderator:
Top