Sprite sheets give me a headache

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Sprite sheets give me a headache

Post by richmond62 » Sun Oct 10, 2021 4:01 pm

They do, you know, because I am sick and tired of spending yonks chopping them up into individual
images to use as backGroundPatterns for a graphic . . .

I am looking for guidance (NO, not THAT kind of guidance) on how I might use a sprite sheet in its raw, unprocessed form
to animate inwith a grc 'frame.
-
SShot 2021-10-10 at 17.57.16.png
-
NOT "cutting the mustard."
Last edited by richmond62 on Sun Oct 10, 2021 6:19 pm, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Sprite sheets give me a headache

Post by richmond62 » Sun Oct 10, 2021 6:08 pm

SShot 2021-10-10 at 20.01.18.png
-
Well; here's a crappy solution that uses a grouped image, but presupposes that one knows
where the centre of each image inwith the
sprite image lies (which I don't: hence the crappy result).

At which point, I suppose, I could piss about, chopping up the sprite image
to reposition the sprites to predetermined locations
(one could do that with importing a folder of the chopped up images, grouping them
and then importing a snapshot from the group), which is almost as fun as
banging one's head on the wall, chopping up the sprite image into bits for
backGroundPatterns, or standing on one leg for 25 years.
Attachments
Sprite Handler 2.livecode.zip
Here's the stack.
(71.08 KiB) Downloaded 102 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Sprite sheets give me a headache

Post by richmond62 » Sun Oct 10, 2021 6:13 pm

https://codeshack.io/images-sprite-sheet-generator/
You can use your favorite coding language to select the coordinates of each image and display them accordingly
Err, well, जै . . . I wonder how I can do THIS in my favOUrite coding language (erm: LiveCode)?

AND, if LiveCode could do that, I could just be lazy and get my sprite sheets from places like this:

https://itch.io/game-assets/free/tag-side-scroller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Sprite sheets give me a headache

Post by richmond62 » Sun Oct 10, 2021 7:13 pm

A lot better than Paracetemol:

https://github.com/bmarwane/spriteSplitter

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Sprite sheets give me a headache

Post by richmond62 » Sun Oct 10, 2021 7:27 pm

SShot 2021-10-10 at 21.24.51.png
-
This, of course, is totally beside the point

[although it is rocky that I found something that chops up sprite sheets quicker than I can cut open
my thumb with a penknife.]

as it does NOT answer my original questions (either of them).
Attachments
Sprite Handler 3.livecode.zip
Here's the stack.
(98 KiB) Downloaded 123 times

Kangaroo SW
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 35
Joined: Sat Jan 15, 2011 10:57 am

Re: Sprite sheets give me a headache

Post by Kangaroo SW » Mon Oct 11, 2021 7:01 am

Explore this :D
Attachments
spritesexample2.livecode.zip
(168.69 KiB) Downloaded 118 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Sprite sheets give me a headache

Post by richmond62 » Mon Oct 11, 2021 8:13 am

Thank you very much Kangaroo SW:

1. Very clever.

2. No obvious benefit over using individual images

(just more complicated coding).

jiml
Posts: 336
Joined: Sat Dec 09, 2006 1:27 am
Location: Los Angeles

Re: Sprite sheets give me a headache

Post by jiml » Mon Oct 11, 2021 4:23 pm


richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Sprite sheets give me a headache

Post by richmond62 » Tue Oct 12, 2021 8:50 am

Screen Shot 2021-10-12 at 10.48.56 AM.png
Screen Shot 2021-10-12 at 10.48.56 AM.png (21.94 KiB) Viewed 6501 times
-
Thank you.

Very clever, very complicated and ALL for the sake of NOT chopping up a sprite sheet.

The effort, in my case at least, does not seem justified.

stam
Posts: 2741
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Sprite sheets give me a headache

Post by stam » Tue Oct 12, 2021 11:29 am

richmond62 wrote:
Tue Oct 12, 2021 8:50 am
The effort, in my case at least, does not seem justified.
The main benefit as far as i can see is you're managing just 1 image instead of say 12 or 20. It does require extra effort in preparing the images to just one image, as all cells have to be the same size and all images have to be centred in that cell, but that's a 1-time job.

I'm not sure the output is any different/speedier, but when working with an app, managing just one image greatly simplifies things i suppose.

S.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Sprite sheets give me a headache

Post by richmond62 » Tue Oct 12, 2021 12:18 pm

all cells have to be the same size and all images have to be centred in that cell
These both seem disadvantages as with a series of images of differing dimensions on displaying them
in a graphic as a backGroundPattern one can reset the graphic;s dimensions to take the image
dimensions into account.

Sprites of this sort:

https://aamatniekss.itch.io/fantasy-kni ... r?download
-
_AttackNoMovement.png
_AttackNoMovement.png (1.69 KiB) Viewed 6448 times
-
have to be chopped up into individual images UNLESS jiml's Cel-animation
can be modded to change the dimensions of the group containing the sprite sheet for each frame.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Sprite sheets give me a headache

Post by richmond62 » Tue Oct 12, 2021 12:54 pm

As I am considering writing a leaflet not called "Making Side Scrolling Games for Morons", that is the title
I will be repeating under my breath.
Last edited by richmond62 on Thu Oct 14, 2021 9:32 am, edited 1 time in total.

xAction
Posts: 86
Joined: Sun Oct 03, 2021 4:14 am

Re: Sprite sheets give me a headache

Post by xAction » Tue Oct 12, 2021 2:39 pm

Your Warrior sprite doesn't need to change size for each sprite.
One Size to Rule them all
SpritesExample.png
SpritesExample.png (3.1 KiB) Viewed 6387 times
You can make SpriteSheets with ImageMagick
or cut it into pieces

The active part of that sprite is the sword
Is enemy character within the rect of the sprite container? Is sword attack animation active? Take damage.
Is enemy character within the rect of the sprite container? Are they left of the center? Are they attacking? Warrior dies!
Wawawa

jiml
Posts: 336
Joined: Sat Dec 09, 2006 1:27 am
Location: Los Angeles

Re: Sprite sheets give me a headache

Post by jiml » Tue Oct 12, 2021 4:19 pm

I did that years ago and not to avoid chopping a sprite sheet but to get blindingly fast animation in LiveCode.
You're welcome!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Sprite sheets give me a headache

Post by richmond62 » Tue Oct 12, 2021 5:41 pm

to get blindingly fast animation
Ah, I understand, but, nothing I ever do is blindingly fast. 8)
One Size to Rule them all
Not always!
-
Zombie.png
-
Great source: https://craftpix.net/

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”