Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6581 leency 1
--ANIM: Sprite Animator v0.15
2
--Spare page holds data - Plays on current
3
--by Richard Fhager
4
 
5
run("../libs/memory.lua")
6
 
7
arg=memory.load({XS=16,YS=16,SPACE=1,FRAMES=8,XOFF=0,YOFF=0,FPS=10})
8
 
9
OK, XS, YS, SPACE, FRAMES, XOFF, YOFF, FPS = inputbox("Sprite-Sheet Animator",
10
 "Sprite X-size",   arg.XS,    1, 256,0,
11
 "Sprite Y-size",   arg.YS,    1, 256,0,
12
 "Spacing",         arg.SPACE, 0,  32,0,
13
 "# of Frames",     arg.FRAMES,2, 100,0,
14
  "X-offset",        arg.XOFF,  0, 800,0,
15
  "Y-offset",        arg.YOFF,  0, 800,0,
16
 "Play Speed (FPS)",arg.FPS,   1,  60,0
17
);
18
 
19
 
20
if OK == true then
21
 
22
memory.save({XS=XS,YS=YS,SPACE=SPACE,FRAMES=FRAMES,XOFF=XOFF,YOFF=YOFF,FPS=FPS})
23
 
24
 MAXPLAYS = 100
25
 
26
 w,h = getpicturesize()
27
 OX = w / 2 - XS/2
28
 OY = h / 2 - YS/2
29
 
30
 for play = 1, MAXPLAYS, 1 do
31
 
32
 for f = 0, FRAMES-1, 1 do
33
  for y = 0, YS-1, 1 do
34
   for x = 0, XS-1, 1 do
35
    sx = x + XOFF + f * (XS + SPACE)
36
    sy = y + YOFF
37
    putpicturepixel(OX+x, OY+y, getsparepicturepixel(sx, sy))
38
   end
39
  end
40
  updatescreen(); if (waitbreak(1/FPS)==1) then return; end
41
 end
42
 
43
 end -- plays
44
 
45
end --OK
46