I'm trying to do animation in a function. I'm using a repeat while statement along with "the tics" to simulate frames. I have 3 members as the frames of animation. Problem: the animation does not occur untill after the function. So it sits there for a second then all of the sudden opens, without showing ne of the in between frames. I tried using updateStage, but it didnt seem to help. Heres the script, ne one know a better way to do it?
on openDoor(doortype, dir)
tilecoords = getTile(dir)
thex = tilecoords.x
they = tilecoords.y
thetilenum = tilecoords.x + 24 * tilecoords.y
attrib = thex & "x" & they & "_left"
myleft = getprop(g_sprites,attrib)
attrib = thex & "x" & they + 1 & "_top"
mytop = getprop(g_sprites,attrib)
--------------------------------------------------------
if doortype = "hwoodendoor_cement" then
startticks = the ticks
repeat while the ticks <= startticks + 60
case the ticks of
startticks: theframe = "door00"
(startticks + 30): theframe = "door01"
(startticks + 60): theframe = "doorOpen"
end case
member("map"
.image.copyPixels(member(theframe).image, rect(myleft, mytop,myleft + 76, mytop + 76), member(theframe).rect)
updateStage
end repeat
put "0" into char thetilenum of g_mapclipstring
end if
end
------------------------------------------------------------
on openDoor(doortype, dir)
tilecoords = getTile(dir)
thex = tilecoords.x
they = tilecoords.y
thetilenum = tilecoords.x + 24 * tilecoords.y
attrib = thex & "x" & they & "_left"
myleft = getprop(g_sprites,attrib)
attrib = thex & "x" & they + 1 & "_top"
mytop = getprop(g_sprites,attrib)
--------------------------------------------------------
if doortype = "hwoodendoor_cement" then
startticks = the ticks
repeat while the ticks <= startticks + 60
case the ticks of
startticks: theframe = "door00"
(startticks + 30): theframe = "door01"
(startticks + 60): theframe = "doorOpen"
end case
member("map"
updateStage
end repeat
put "0" into char thetilenum of g_mapclipstring
end if
end
------------------------------------------------------------