How do I create lifespan for sprites?

Get help using Construct 2

Post » Tue Apr 29, 2014 1:23 pm

Hi!

I have a game I'm trying to update with functions for my NPCs. The NPCs spawn from action and I want them to have a certain lifespan before automated destroy. I've setup an instance variable but I couldn't find the action to compare the variable so that it can be followed by a destroy action on a certain number. I was just wondering if someone can tell me if I'm doing this correctly or is there a step I missed?

Thanks for anyones help!
B
17
S
2
Posts: 34
Reputation: 853

Post » Tue Apr 29, 2014 1:27 pm

hmm, set the instance variable to a value (I would say seconds) until it should be destroyed. Each second, deduct 1 from the variable for each of the sprites.

For each NPC Sprite, if variable <= 0, destroy it.


EDIT: Example attached

BTW.: To know if you did it correctly it is always a good idea to attach your project file, that we can have a look into it ;)
You do not have the required permissions to view the files attached to this post.
B
44
S
10
G
8
Posts: 437
Reputation: 6,463

Post » Tue Apr 29, 2014 1:53 pm

Thanks! Trying out now.
B
17
S
2
Posts: 34
Reputation: 853


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, Fenix18, lordsas, mekonbekon and 66 guests