Animation needs to extend past sprite boundaries

For questions about using Classic.

Post » Sat Feb 13, 2010 6:08 am

I have a 64x64 sprite (actually scaling from 302x302) and for a certain animation, the sprite stretches out part of his body to hit an enemy. The frames for this attack animation would be 64x128 because the sprite is actually bigger just during those animations. I tried temporarily making the sprite 64x128, but since my pivot point was in the middle of my sprite, it added the extra width onto both sides (32 pixels on each side rather than 64 pixels in the direction he's facing) and made it look weird. I tried making the canvases on all my animations bigger, but since my pivot point was still where it was when it was just 64x64 rather than in the new center of the image, it wouldn't flip right.

So basically, I keep failing at this. Is there an easy way to use my 64x128 animation with my normally 64x64 sprite without making it look like the sprite moved or anything, just extended? Imagine a 64x64 box shooting out a 64 pixel width arm and punching an enemy. That is essentially what my sprite is doing.

Note: The only idea I have left is to use 64x256 (64 in the middle for the regular sprite, then 64 on each side for the attack animation for each direction) images and do the facing left and facing right images for all my animations myself rather than Auto Mirroring.

Edit: Okay, I tried the above and it insanely raises the VRAM. It went from about 20 MB to almost 75 MB...
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Sat Feb 13, 2010 6:32 am

Did you try adjusting with the hotspot?
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Sat Feb 13, 2010 6:49 am

[quote="Mr Wolf":1kseogdi]I have a 64x64 sprite (actually scaling from 302x302) [/quote:1kseogdi]

If you're just going to show the sprite at 64x64 then why is your original image 302x302? That's crazy wasteful. Resize your sprite in Photoshop or something and then import it into Construct.

[quote="Mr Wolf":1kseogdi]I tried temporarily making the sprite 64x128, but since my pivot point was in the middle of my sprite, it added the extra width onto both sides (32 pixels on each side rather than 64 pixels in the direction he's facing) and made it look weird.[/quote:1kseogdi]

You need to change your hotspots. They don't have to be in the center. If you have a sprite of a boxer, and the hotspot is on his shorts, then to make him stay "still" across all frames you need to put the hotspot on his shorts. When he throws a punch his sprite might be getting wider, but you still need to place the hotspot where it belongs instead of the center.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Feb 13, 2010 6:59 am

Ah, I understand now. I misunderstood how Hotspots worked. Thanks for clearing that up.

As for the 302x302 sprite. When I resized him in Photoshop his sprite had less detail then having Construct scale it (don't know how that happened), so for early development I kept it at original resolution, but I know what you mean. I'll resize it. VRAM builds up quick...

Edit: Wait...no, I didn't misunderstand before. My Hotspot needs to be in the center for Auto Mirror to look right, but needs to be at X=0 when I resize, so I think I need to temporarily switch hotspots just during the resize so all the extra width goes on the right side of the sprite rather than being split on each side (when it is split on each side, it looks like you moved all of a sudden). I'll work on this more tomorrow. Being tired=terrible game development.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Sat Feb 13, 2010 2:34 pm

I solved it! I thought I would have to tell the sprite to change size for the animation, otherwise it would squish the 128x64 frames into the 64x64 sprite size. Nope. Construct does all the work of extending the sprite itself! It is amazing how much Construct does for you...
B
2
S
2
G
2
Posts: 372
Reputation: 1,794


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests