Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Animation from a Function

Status
Not open for further replies.

fugigoose

Programmer
Jun 20, 2001
241
0
0
US
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 = &quot;door00&quot;
(startticks + 30): theframe = &quot;door01&quot;
(startticks + 60): theframe = &quot;doorOpen&quot;
end case
member(&quot;map&quot;).image.copyPixels(member(theframe).image, rect(myleft, mytop,myleft + 76, mytop + 76), member(theframe).rect)
updateStage
end repeat
put &quot;0&quot; into char thetilenum of g_mapclipstring
end if
end
------------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top