How do I Spawn an other object

Get help using Construct 2

Post » Sat Jul 30, 2016 11:59 pm

ok here is what i want to do
every 10 seconds
i want to spawn an asteroid but he have 80 frames
i want to set a diferent frame for each spawn

problem is when i do so they all change frame each 10 sec XD not just the new created one

can anyone make me a little capx :D
B
29
S
9
G
3
Posts: 139
Reputation: 3,806

Post » Sun Jul 31, 2016 12:29 am

B
17
S
9
G
5
Posts: 74
Reputation: 4,145

Post » Sun Jul 31, 2016 2:41 am

ty so much :D
so basically its
round(random(Self.AnimationFrameCount))

self mean only the one being created ?
B
29
S
9
G
3
Posts: 139
Reputation: 3,806

Post » Sun Jul 31, 2016 3:28 am

@kiugetski

No, it is a shortcut.

Your problem, I think, is that you were dealing with an unreferenced object. Check out the paragraph on unreferenced objects here: https://www.scirra.com/manual/75/how-events-work

If you don't reference an object at the beginning of your event, it will act on all instances of that object. In my example, "create object" is the reference the system uses to choose which Sprite instance to act upon. Therefore, only the newly created instance changes frame.

I hope this helps!
B
17
S
9
G
5
Posts: 74
Reputation: 4,145

Post » Sun Jul 31, 2016 3:51 am

ok well i did it on the game and it worked fine :D

http://kiugetski.com/space/
B
29
S
9
G
3
Posts: 139
Reputation: 3,806


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests