Setting the frame upon creation of instance

For questions about using Classic.

Post » Sun Jul 12, 2009 2:26 pm

For my game, I'm generating clouds with a random Y value that scroll to the left. Because they're rather big images, I combined them all as frames of one sprite. When a new cloud is spawned, I want to randomize the frame it draws on the screen, but I have no idea how I can do that without randomizing it for every cloud that is already spawned.

So in short, I'm asking this:
Is there a way to set the animation frame for an instance when it is created?
I appreciate your help.
B
1
G
3
Posts: 7
Reputation: 839

Post » Sun Jul 12, 2009 2:32 pm

Any action in an event which runs after a 'Create' will run only on the created object, so simply add it there :).
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sun Jul 12, 2009 2:51 pm

Oh, I didn't know that! :D It totally worked and got me out of a heckload of trouble
B
1
G
3
Posts: 7
Reputation: 839

Post » Mon Jul 13, 2009 3:05 am

[quote="mediyama":2swcllw2]Because they're rather big images, I combined them all as frames of one sprite.[/quote:2swcllw2]
This doesn't make it use any less data, it's only for convenience sake.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests