sprite destroy after x second

Discussion and feedback on Construct 2

Post » Wed Oct 17, 2012 9:22 am

Hi all,
Is there a solution to set a life for sprite this means if i have many instance of sprite the oldest will be destroyed first...
please give me solution it's urgent
Thanks guys
B
5
S
1
Posts: 49
Reputation: 723

Post » Wed Oct 17, 2012 9:39 am

Give sprite a variable and do this:



This will destroy Spriter once it's been alive for 1 second.alspal2012-10-17 09:41:10
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Wed Oct 17, 2012 10:13 am

does 1 tick always = 1/60 of a second even on slow systems where the fps is 20 or 30?
B
41
S
11
G
4
Posts: 428
Reputation: 7,356

Post » Wed Oct 17, 2012 10:18 am

Framerate/tickrate/FPS doesn't stay the same on every computer. Which is why you have to use "dt" in expressions so that your game is consistent.

Ashley wrote about this.alspal2012-10-17 10:18:35
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Wed Oct 17, 2012 12:05 pm

thanks friends for your helps,
B
5
S
1
Posts: 49
Reputation: 723

Post » Wed Oct 17, 2012 2:21 pm

Another option is to use Fade, as discussed here: Destroy Sprite after X time
ImageImageImage
B
67
S
19
G
123
Posts: 3,209
Reputation: 73,905

Post » Wed Oct 17, 2012 10:49 pm

so if i use the Sine or Bullet behavious, it will not play the same on different computer with different fps?

will i have to use *dt on all of the figures in Sine or Bullet?bjadams2012-10-17 22:53:33
B
41
S
11
G
4
Posts: 428
Reputation: 7,356

Post » Wed Oct 17, 2012 11:05 pm

Behaviours already use 'dt', so don't worry about them.
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Wed Oct 17, 2012 11:09 pm

The Fade behavior is great for that, because you don't need any other events for it. Just set the wait time to whatever you want, and the rest to 0
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Thu Oct 18, 2012 6:43 am

Yeah I agree with 7Soul and BlackHornet above....I Just use the Fade Behavior..
I used to wonder about this same function until I saw the Fade Behavior...
Not only does it work perfectly, has 2 built in timer functions and you can do a gentle fade out function if you like also but it also has the Built in Destroy after Fade options..Pretty simple.. I Think its there for that single reason..Maybe someone could add that to the Manual ...

Well spotted lads..and you beat my post to the line..Kudos!
I think its unanimous now right...

A very well designed built in Behavior.....

Its good to see how versatile Construct 2 behaviors are...
there is so much you can do with them if you play around some and be will ing to make mistakes...we all do....experimentation is the key!
mystazsea2012-10-18 06:45:22
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
29
S
11
G
8
Posts: 313
Reputation: 7,335

Next

Return to Construct 2 General

Who is online

Users browsing this forum: armaldio, Clintonpacheco, saiyadjin and 0 guests