Page 1 of 1
Animated Characters from External Source
Posted: Thu Sep 16, 2021 5:17 pm
by archimede
Hi,
if I make my own animated characters using external animation software,what is the best way to play them in a Livecode generated game? I remember that when Livecode was still Runtime Revolution, I tried importing animated GIFs and this made my program freeze on older processors; besides GIFs RunRev seemed to support only Quicktime, no Flash, AVI or any other video/animation format, so I gave up and quit ...
thank you ...
Re: Animated Characters from External Source
Posted: Thu Sep 16, 2021 5:24 pm
by Klaus
Hi archimede,
unfortunaltey animated GIF is still the only "animation" format compatible with LC.
But nowadays LC will accept all video formats that your operating system can play like MP4.
Best
Klaus
Re: Animated Characters from External Source
Posted: Thu Sep 16, 2021 6:02 pm
by richmond62
Not quite . . .
You can export frames from an animated GIF in PNG format and then set them as the
backGroundPattern
to a rectangular graphic set the the size of the animation frames.
-
Re: Animated Characters from External Source
Posted: Thu Sep 16, 2021 6:09 pm
by Klaus
Yes, sure, but I would NOT call this an external animation format.
Re: Animated Characters from External Source
Posted: Thu Sep 16, 2021 6:38 pm
by richmond62
Well, as the frames were exported (with GIMP) from a .GIF image, which IS an
external animation format . . . .
Re: Animated Characters from External Source
Posted: Thu Sep 16, 2021 6:46 pm
by richmond62
It might be possible, at a squeeze, to import an animated SVG with the SVG widget . . .
https://app.svgator.com/auth/register#/
I wonder why the 'Sample Stacks' stack is glacially slow to load?
Unfortunately James Lynch's wonderful SVG Power Images cannot cope with animated SVG images:
-
Re: Animated Characters from External Source
Posted: Thu Sep 16, 2021 6:55 pm
by Klaus
richmond62 wrote: ↑Thu Sep 16, 2021 6:38 pm
Well, as the frames were exported (with GIMP) from a .GIF image, which IS an
external animation format . . . .
Yes, but come into LC as PNG files, which is not an external animation format!
Re: Animated Characters from External Source
Posted: Thu Sep 16, 2021 7:10 pm
by richmond62
Well, to be honest, to get
animation working in any sort of controllable fashion inwith
LiveCode
one has to either mess around with
backGroundPattern in a graphic or mess around with visible
and a pile of images layered on top of each other.
Unless, of course, you want to work with Malte's
Animation Engine.
https://github.com/derbrill/animationEngine
Re: Animated Characters from External Source
Posted: Thu Sep 16, 2021 8:54 pm
by Bill
- 1. create a spritesheet
2. import to livecode
3. group the image
4. resize group to the size of your 'sprite'
5. set the lockloc of the group to true
6. in an init handler set the hScroll and vScroll to frame N of your sprite sheet
7. send a message to your animation handler
8. increment the hScroll of the sprite sheet by the Width of your sprite bounding area
9. reset the hScroll to 0 when you hit the width of your image source
10. control onscreen movement of your group via scripts
Code: Select all
on mouseUp
set the vScroll of group "zombie" to 512 -- position to last line of spritesheet
set the hScroll of group "zombie" to 1 -- first frame of fifth row
walkZombie
end mouseUp
on walkZombie
if the tool is not "browse tool" then exit walkZombie -- exit for scripting
put the thumbPosition of scrollbar "AnimationRate" into tRate
put the width of image "zombie"-128 into w
put the hScroll of group "Zombie" into hS
if HS < w then
add 64 to hS
else
put 1 into hS
end if
set the hScroll of group "zombie" to hs
send walkZombie to me in tRate milliseconds
end walkZombie
Online tool for making sprite sheet
TexturePacker standalone tool
Spritesheet via imagemagick
Or roll your own in Livecode
-
Re: Animated Characters from External Source
Posted: Thu Sep 16, 2021 9:28 pm
by stam
Or you could use JimL's cel animation technique he links to here:
viewtopic.php?f=7&t=36110&p=207185&hili ... on#p207171