Hi, this is all of the code so far :
rem chaos
rem by TheComet
rem setup screen
sync on
sync rate 60
backdrop on
color backdrop 0
hide mouse
rem types
type engine
active as byte
imagenum as word
spritenum as word
frame1start as word
frame1end as word
endtype
type vec3
x as float
y as float
z as float
endtype
type frame
framestart as word
frameend as word
endtype
rem global variables
global mouse as engine
global ret as vec3
global filename$ as string
rem arrays
dim frameret(4) as frame
rem setup game
make_mouse()
rem main loop
do
rem control engine
gosub control_engine
rem refresh screen
sync
rem end of main loop
loop
rem game engine
rem ----------------
function make_mouse()
rem locals
local n as dword
rem check if mouse has already been made
if mouse.active=1
rem activate mouse
mouse.active=2
endif
rem if mouse has not been made, create
if mouse.active=0
rem activate mouse
mouse.active=2
rem load mouse animation
load_animation("animations\mouse.ani")
rem find a free sprite and create animated sprite
for n=1 to 65535
if sprite exist(n)=0 then exit
next n
mouse.imagenum=ret.z
mouse.spritenum=n
mouse.frame1start=frameret(0).framestart
mouse.frame1end=frameret(0).frameend
create animated sprite mouse.spritenum,"temp\image.bmp",ret.x,ret.y,mouse.imagenum
set sprite mouse.spritenum,0,0
endif
endfunction
function load_animation(filename$)
rem locals
local freeimage as word
local n as dword
local images as word
local frames as word
rem find a free image
for n=1 to 65535
if image exist(n)=0 then exit
next n
freeimage=n
rem load images
open to read 1,filename$
rem read in image amount
read word 1,images
rem read in background color
read byte 1,r
read byte 1,g
read byte 1,b
set image colorkey r,g,b
rem read in frame data
read word 1,frames
for n=1 to frames
read string 1,string$
read word 1,frameret(n-1).framestart
read word 1,frameret(n-1).frameend
next n
rem get image dimensions
read word 1,width
read word 1,height
rem read in image data
create bitmap 1,width*images,height
for n=1 to images
if file exist("temp\image.bmp") then delete file "temp\image.bmp"
read fileblock 1,"temp\image.bmp"
rem load image and add to bitmap
set current bitmap 1
load image "temp\image.bmp",freeimage
paste image freeimage,(n-1)*width,0
delete image freeimage
next n
close file 1
rem get final image
get image freeimage,0,0,width*images,height
delete bitmap 1
if file exist("temp\image.bmp") then delete file "temp\image.bmp"
save image "temp\image.bmp",freeimage
delete image freeimage
rem store return values
ret.x=width*images
ret.y=height
ret.z=freeimage
endfunction
control_engine:
rem control mouse animation
paste sprite mouse.spritenum,mousex(),mousey()
play sprite mouse.spritenum,mouse.frame1start,mouse.frame1end,1
return
Media attached. Place it in a folder called "animations".
Why do I only get one little pink dot on screen? Am I using the
create animated sprite command incorrectly or something? This is what happens if you start with 3D first, and THEN go on to learn 2D...
TheComet