How do I load sprite animation frames at runtime?

Get help using Construct 2

Post » Mon Dec 08, 2014 2:52 pm

Hello everyone,

I'm looking for a way to apply new images to a sprite, to all its animations, to all its frames.
Basically a way to replace the graphic of a sprite entirely and achieve a generic sprite able to load any content.

I will explain this better with an example...
Let's say I have 5 enemy types. They can all do exactly the same actions: shoot, explode, fly, etc. (each action is an animation)
I would then tell C2 to create a sprite/object of type "generic enemy" and set all the properties (images, speed, health, damage, etc) by XML.
A single sprite therefore is doing the common jobs requested to all the enemies and, since the animations are common, I can still tell C2 to start an animation and listen for its completion and I can control all enemies writing 1 event sheet instead of 5 :)

In C++ I would say I'm creating a base class, but I can't figure out the way to achieve such result in C2.

Thanks for your help!
Posts: 2
Reputation: 229

Post » Mon Dec 08, 2014 2:54 pm

That's what Families give you.
Posts: 3,886
Reputation: 159,513

Post » Mon Dec 08, 2014 3:04 pm

Awesome! That's exactly what I was searching
Thank you
Posts: 2
Reputation: 229

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests