07-09-2009, 05:43 PM
LTee Wrote:Holy crap! I figured out what the problem was and got the game up and running and it's so much faster than the version I had compiled with Hisoft's compiler it's unbelievable! I'm going to have to slow it down, it's just unplayable! :-DWow! Nice to hear that. Believe or not, these things are what motivates me a lot!! :!: :wink:
Amazing work!
My problem was a simple syntax misunderstanding with the positioning of END IF on lines which have multiple IF statements - I didn't realise IFs could be nested so I'd put one of the END IFs in the wrong place. This meant that the second IF statement on the line was running even if the first IF statement didn't, and that was messing up the game logic.
I initially did this:
Code:2320 IF dead=1 THEN PRINT INK 8; PAPER 8;AT y,x;" ": LET x=newx: LET y=newy: GO SUB 4900: END IF: IF dead=0 THEN GO TO 2000: END IF
But what I should have done was this:
Code:2320 IF dead=1 THEN PRINT INK 8; PAPER 8;AT y,x;" ": LET x=newx: LET y=newy: GO SUB 4900: IF dead=0 THEN GO TO 2000: END IF: END IF
... so that the second IF statement only runs if the first IF statement is true.
So... back to the trying to figure out how to slow this thing down. :mrgreen:
To slow down things I was preparing the Sleep(Frames) function, which is exactly like PAUSE but won't return on a keypress.
For better legibility, you can write that line this way:
Code:
2320 IF dead=1 THEN
PRINT INK 8; PAPER 8;AT y,x;" "
LET x=newx: LET y=newy
GO SUB 4900
IF dead=0 THEN GO TO 2000: END IF
END IF