Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / SetSpriteAnimation for more than one spritesheet

Author
Message
BraindeaD
16
Years of Service
User Offline
Joined: 30th Mar 2008
Location:
Posted: 18th Jan 2013 17:47
Hi all,
I'm trying figure how I can assing several spritesheets (one per animation) to one sprite instead add the frames individually. Is it possible? (the option of a very big sprite sheet with all animation frames is not viable due the great number of frames and the bitmap size needed to include all of them).
Thanks in advance.

Oscar
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th Jan 2013 18:08
I don't believe you can do what you want.

The options are one sprite sheet or multiple image frames.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 18th Jan 2013 19:11 Edited at: 18th Jan 2013 19:13
@BraindeaD

I'm not sure I understand what you are asking, so I'll answer something related and hope you find some help.

Recently I wanted an effect where the light could be turned out on a scene. Rather than just darkening the sprites which wasn't what I was looking for, I decided to use different graphics for the darkened scene.

All the sprites took their frames from one image 1024x1024 with frame sizes of 128x128, giving 64 Frames - the animation was quite basic for the test I was doing.

When the light was turned out, I pointed all the sprites to a different image with different graphics, but the same frame layout.

All the sprites changed to the new graphics, yet their animations continued uninterrupted.

In this way I was using multiple sprite sheets with the same sprites without having to re-set the frames, or redo the animations.

In case that is related to what you were asking.

A second example worked in the same way, but used a bar the full width of the screen, which scanned up and down. As the bar crossed the sprites, their image changed producing an effect like an scanner.

I used setscissor() to change the sprite images on the fly and where the bar crossed a sprite, the parts of the sprite at either side had different images - the effect took me back to the Amiga days.

If anyone is interested, I'll dig out the code.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th Jan 2013 19:26
Marl, I hadn't thought of changing the sprite image that easily. It sounds like a cool way to do things.

BraindeaD, assuming you want a continuous playing of all the images from all the files, you would need to monitor the active frame being shown. When it reaches the last frame, stop the animation, swap in the next image (using SetSpriteImage) and restart the animation at frame 1. The stop/start animation might not be necessary.

You would need to be sure that all of the image files are the same size and that that the frames within the files are the same size across files and have the same number of frames in each file (so the SetSpriteAnimation command would work for all files).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
BraindeaD
16
Years of Service
User Offline
Joined: 30th Mar 2008
Location:
Posted: 19th Jan 2013 06:01
Hi all,
thanks Ancient Lady and Marl.
I've tried Marl's method and works really well.
Thanks both for your help!

Login to post a reply

Server time is: 2024-11-24 05:51:23
Your offset time is: 2024-11-24 05:51:23