Scripts / Delete Sprite based on Timer?

Author
Message
Nathan38
13
Years of Service
User Offline
Joined: 13th Feb 2011
Location:
Posted: 2nd Jul 2016 10:06
Hi all,
Can anyone tell me what's going on here? I've never used timers before so I think that's the issue? Basically the sprite shows properly and all that but it doesn't go away after 2 seconds.



Thanks!
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 2nd Jul 2016 10:09
Start timer also acts like reset timer (if there was such a command) so the gettimer in this script is always going to be 0.
You need to call starttimer only once when needed
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Nathan38
13
Years of Service
User Offline
Joined: 13th Feb 2011
Location:
Posted: 2nd Jul 2016 10:50
Hi smallg,
Thanks for getting back to me. So does that mean that I should do "if StartTimer > 2000 then"? Sorry I'm not firing on all cylinders this morning
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 2nd Jul 2016 12:46
No you should prevent the function StartTimer(e) to start again, so it should look more like this
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
Nathan38
13
Years of Service
User Offline
Joined: 13th Feb 2011
Location:
Posted: 3rd Jul 2016 08:37 Edited at: 3rd Jul 2016 08:48
Hi Corno_1,
That works perfectly, however what should I do if I want to do that for multiple sprites? for example if the players level has gone up to 2 instead, should I set the timerstarted to 0 in line 13 of the snippet posted?

EDIT:
Nevermind, I think I sorted it.

Thanks again all!

Login to post a reply

Server time is: 2024-12-22 18:15:00
Your offset time is: 2024-12-22 18:15:00