Animated Characters from External Source

Creating Games? Developing something for fun?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
archimede
Posts: 7
Joined: Fri Oct 17, 2008 4:01 pm

Animated Characters from External Source

Post by archimede » Thu Sep 16, 2021 5:17 pm

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 ...

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Animated Characters from External Source

Post by Klaus » Thu Sep 16, 2021 5:24 pm

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

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

Re: Animated Characters from External Source

Post by richmond62 » Thu Sep 16, 2021 6:02 pm

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.
-
Flying.png
Attachments
Fairy.livecode.zip
Here's the stack.
(6.88 KiB) Downloaded 182 times
Last edited by richmond62 on Thu Sep 16, 2021 6:39 pm, edited 1 time in total.

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Animated Characters from External Source

Post by Klaus » Thu Sep 16, 2021 6:09 pm

Yes, sure, but I would NOT call this an external animation format. 8)

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

Re: Animated Characters from External Source

Post by richmond62 » 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 . . . . 8)

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

Re: Animated Characters from External Source

Post by richmond62 » Thu Sep 16, 2021 6:46 pm

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:
-
SShot 2021-09-16 at 20.55.52.jpg
Last edited by richmond62 on Thu Sep 16, 2021 6:57 pm, edited 1 time in total.

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Animated Characters from External Source

Post by Klaus » Thu Sep 16, 2021 6:55 pm

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 . . . . 8)
Yes, but come into LC as PNG files, which is not an external animation format! :D

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

Re: Animated Characters from External Source

Post by richmond62 » Thu Sep 16, 2021 7:10 pm

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

Bill
Posts: 57
Joined: Sat Apr 08, 2006 8:22 pm

Re: Animated Characters from External Source

Post by Bill » Thu Sep 16, 2021 8:54 pm

  • 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

-
SpriteSheetAnimation.zip
<<-- simple sprite animation example
(182.99 KiB) Downloaded 195 times

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

Re: Animated Characters from External Source

Post by stam » Thu Sep 16, 2021 9:28 pm

Or you could use JimL's cel animation technique he links to here: viewtopic.php?f=7&t=36110&p=207185&hili ... on#p207171

Post Reply

Return to “Games”