Safest way to replace a sprite's animations?

Get help using Construct 2

Post » Sat Nov 17, 2012 11:35 pm

In a small team, one might have a programmer and a graphic designer.

Let's say the programmer writes up all the logic involving a sprite called Cat. Currently, Cat contains only the 'Walking' animation.

A few months later, the graphic designer sends the programmer an updated Cat object, which contains a 'Walking', 'Running', 'Meowing', 'Purring', and 'Jumping' animation.

What is the most efficient way for the programmer to go about updating Cat's animations, while preserving the instance variables and events of Cat?

My initial thought was to re-save the Construct project to use a directory instead of a single file, and then replace the Cat's animation folder. Would this be the correct way of doing it, or could it potentially create problems?

Thanks for your help!

Dalal
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Sun Nov 18, 2012 11:05 pm

I've settled on replacing the Animations folder and replacing the <animation-folder> node in the .caproj. Looks to me like there would be no problems with this approach, except accidentally corrupting the project somehow. I'll just backup my project before doing the change.

If anybody knows of a cleaner way to replace an object's animations, let me know.

Thanks!

Dalal
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Sun Nov 18, 2012 11:43 pm

Honestly, what you'll want to use are basically variable dimensions in your events. So if your Cat idle animation is 32 pixels wide, instead of putting in your events "Cat is 32 pixels from the left side of the screen" instead you would do "Cat is Cat.Width from the left side of the screen". Little things like that. Then you can import the new animations and frames like normal without worrying about breaking your programming.

That was just a basic example, but it'd probably be good practice to leave just about all your numbers variable rather than hardcoded and static.
B
57
S
20
G
7
Posts: 305
Reputation: 8,779


Return to How do I....?

Who is online

Users browsing this forum: mercuryus, Naightwolf, RookieDev, Skebab and 22 guests