Wednesday, February 13, 2008

IT'S ALIVE!!!

Finally got it moving and refreshing the screen! Spent about 6 hours yesterday including help from David Downes and Danny Kaye trying to fix a bug in the code, not figuring it out at all - we thought of various things it could have been and ended up with the conclusion that one line was only working the first time it was run.

I then found out the line should have worked which made little sense at the time, as we'd spent ages trying to clear the bitmap in case it needed to be cleared before running a copyPixels command again.

So ended up going home with still no idea, had a few further ideas such as parameters and things to check, but somehow I still missed the obvious answer.

A further post on flash forums, posting all my code and other files so far, got a response from a really helpful person called 5TonsOfFlax, who told me what I should have realised way before, I wasn't resetting one variable, which told it where to paste the next tile using copypixels.

What this means is, after the first time it ran through, which would work fine, it would then be copying pixels and working perfectly, but it was copying to x values greater than the screen width so we never saw it! Bah!

The only thing that needed adding to fix the problem was this line:

myX = 0;

Yep, thats right, six or seven hours of painstaking troubleshooting, is fixed with 6 characters of code.

So now, in all its glory, is the shiny new version that MOVES!
(Z = LEFT, X = RIGHT, / = DOWN, ' = UP)

0 comments: