Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / pause the program for x sec while .x animation still play.

Author
Message
Ghost Games
18
Years of Service
User Offline
Joined: 1st Aug 2007
Location:
Posted: 18th Mar 2010 23:33
hi all

anyone that can help with a command that will stop the program for "X" sec while my .x animation still play on


my code :


if spacekey()=1

play object 2,1
play object 3,1
play object 4,1

spinnerATemp = 26

if SpinnerATemp = 26
play object 2,LastSpinnerATemp

set object speed 2,1

rem NEED A COMMAND HERE THAT CAN STOP THE PROGRAM FOR "X" SEC AND THEN READ ON

set object frame 2,52

endif


endif



Thx
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 18th Mar 2010 23:36
wait x*1000

x in seconds.

Windows 7 32-Bit Home Premium Intel Pentium Dual-Core @ 1.46Ghz 2038mb RAM
Ghost Games
18
Years of Service
User Offline
Joined: 1st Aug 2007
Location:
Posted: 18th Mar 2010 23:49
hm... did not work, it pause the program just when i presse the space key, and within the animations are started.

the same thing do the sleep command.
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 18th Mar 2010 23:59
ahh

try t# = timer()

while timer() - t# < x
repeat

I think thats the right pair anyways.

Windows 7 32-Bit Home Premium Intel Pentium Dual-Core @ 1.46Ghz 2038mb RAM
Ghost Games
18
Years of Service
User Offline
Joined: 1st Aug 2007
Location:
Posted: 19th Mar 2010 00:07
hm.. cant compile now
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 19th Mar 2010 00:13
Ahh, sorry for being a douchebag...

t# = timer()

while timer() - t# < x
endwhile

Windows 7 32-Bit Home Premium Intel Pentium Dual-Core @ 1.46Ghz 2038mb RAM
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 19th Mar 2010 00:14
@Mad Nightmare:

Three things, firstly timer() returns an integer, not a float; and secondly it counts in thousandths of a second, rather than seconds. And lastly, it's not while/repeat, its either while/wend or repeat/until.

@Ghost Games:

This is maybe closer to the mark



Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Mar 2010 14:29
@Ghost Games
Are you wanting the game to pause while the animation plays and then continues once the animation is finished?

The fastest code is the code never written.
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 19th Mar 2010 15:19
I think you need to break from your main loop with some if condition and goto second loop in which you play your object starting a timer limiting the second loop how long to play the object, after X seconds past, break from second loop and go to main loop again.

Where there is a will, there is a way.
I often edit my posts, that`s who i am
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 19th Mar 2010 18:13
This...

will do it.

Play the animation, then repeat, until the animation is not playing.

Sorted.

My signature is NOT a moderator plaything! Stop changing it!

Login to post a reply

Server time is: 2026-07-26 23:41:07
Your offset time is: 2026-07-26 23:41:07