ALARM TROUBLE

Posted by blaze on April 24, 2008, 5:44 p.m.

I don't know what to do about a certain game im making!

To do a certain function/extra - animation - I put in an alarm for the object to perform that certain animation BUT im running out

of alarms. I tried to use scripts but that didnt seem to work

an example of code I have at the moment is this!

EVENT: PRESS ENTER

text=get_string("talk",0)

if text='handstand'

{alarm[0]=1

text=''}

EVENT: ALARM[0]

if keyboard_check(vk_right)==false

if keyboard_check(vk_left) == false

{if dir=0

{change_sprite}

else if dir=180

{change_sprite}

So How do I do that alarms actions without using alarms?

N.B I just thought to do it in the EVENT: PRESS ENTER but then

it would eventually get confusing and annoying. So what else can I do?

Comments

firestormx 17 years, 10 months ago

There's probably a better way, but I would think you could do something like this:

EVENT: CREATE

var my_alarm[0] = -1;

EVENT: PRESS ENTER

text=get_string("talk",0)

if text='handstand'

{my_alarm[0]=1

text=''}

EVENT: STEP

if (my_alarm[0] > 0)

{

if (my_alarm[0] == 0)

{

if keyboard_check(vk_right)==false

if keyboard_check(vk_left) == false

{if dir=0

{change_sprite}

else if dir=180

{change_sprite}

}

my_alarm[0] -= 1;

}

I haven't used GM in a year or two, so it may need some tweaking, but the basic idea is that you use a seperate variable that you decrement every step. (Just like an alarm does)

Ferret 17 years, 10 months ago

hmmmmmm if you want something simple, I would just set a variable to the amount of seconds you want times the amount of frames in your room (default is 30) and then in step you could just subtract 1

but thats a really simple way of doing it, why don't you want to use alarms?

gtvg 17 years, 10 months ago

@Ferret - "but im running out of alarms"

Ferret 17 years, 10 months ago

oh ok! thank you! ^_^

JW 17 years, 10 months ago

timelines could also work

svf 17 years, 10 months ago

Variable's with there own time (every step +1 )

so like when VAR = [certain time] then do this.

:P

//EXAMPLE CODE.

[CREATE]global.time=0

[STEP]global.time+1

[END STEP]if global.time=60 { f keyboard_check(vk_right)==false}

//ETC ETC.

blaze 17 years, 9 months ago

Thanks everyone =)

blaze 15 years, 10 months ago

ok reading back on this i'ts now baby stuff, common knowledge, food for the dogs and the like…