Random spawning with a twist

Get help using Construct 2

Post » Wed Nov 13, 2013 6:33 pm

I know this is probably an easy one...

I have a sprite I want to spawn at one of N locations randomly. No big that was easy. Now I need to set the animation to equal an text string that is contained in the spawn points instance vars. Any one know how to catch a reference to the sprite that was just created so I can set the properties?
B
5
Posts: 8
Reputation: 366

Post » Wed Nov 13, 2013 6:57 pm

do it in the same event as the spawn from Nth Location, the details should be available from both.

ie

event on something next action is triggered:
action1: spawnpoint spawn spawnedthing
action2: set spawnedthing.animation(spawnpoint.textstring)lennaert2013-11-13 18:57:55
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Wed Nov 13, 2013 7:09 pm

That works like a charm! Your a rockstart @lennaert!
B
5
Posts: 8
Reputation: 366

Post » Wed Nov 13, 2013 7:17 pm

^_^ your welcome

I recently applied the same technique for an exact same situation :D

Eventually I even added more animations, and had my spawn point string set a value chosen random from a list of strings.

set spawnpoint.textvariable = choose("animation1","animation2","animation3")

you can add as many as you like :)


Good luck
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests