Hello all, I’m working in actionscript 2 and I’m developing a tile based game. Before I can get to the issue, I’ll describe the workflow.
The levels(screens) are arranged in 3 dimensional arrays
so level1=[[1,1,1],[2,2,2],[3,3,3],[4,4,4]];
The level would look like
111
222
333
444
(each number being an id for a tile)
the function genMap handles generating the map
there is one instance of each tile offstage that is a “pure” clip.
genMap moves each pure tile to the position according to it’s position on the array, and then duplicates it, swaps its depth, and places it offstage. etc. etc. until the whole map is loaded.
when you switch maps, a clearMap is run that removes all of the nonpure tiles, and genMap is run again.
during play, you cannot run into walls so each move goes through a function called movePermit that checks each solid tile’s position against your next move. This works fine except for some reason it tends to slow down after a while, until I move to another map and then it works at normal speed again. It seems to happen faster when there are more solids in the current level. I have a debug mode and I have checked to see which functions are running, but all functions run when they should. When you are standing still, no functions are running.
Would anybody know why it’s happening?