0 Members and 1 Guest are viewing this topic.
moveallspritesdown1pixel: PUSH BC LD HL, emptyscreen ; A picture with the game-screen, but then empty, without any sprites , so it basically overwrites the screen LD DE, PlotSScreen+(0*12) ; so that I can draw the sprites again. LD BC, 64*12 LDIR LD A, (Yspr1) CP 64 ; checks if the sprite is out of the screen, and doesn't move the sprite down if so. JR Z, DownSpr2DownSpr1: LD A, (xspr1) LD (xpos), A LD A, (yspr1) INC A LD (ypos), A LD (yspr1), A CALL loadthespriteDownSpr2: LD A, (Yspr2) CP 64 JR Z, DownSpr3 LD A, (xspr2) LD (xpos), A LD A, (yspr2) INC A LD (ypos), A LD (yspr2), A CALL loadthespriteDownSpr3: LD A, (Yspr3) CP 64 JR Z, DownSpr4 LD A, (xspr3) LD (xpos), A LD A, (yspr3) INC A LD (ypos), A LD (yspr3), A CALL loadthespriteDownSpr4: ect ect ect untill 16 sprites are moved down.------ Check Key routine here------ big routine here that checks the location of all the sprites, and acts accordingly------ routine here that shows 2 more sprites------ big routine here that shows 4 more sprites b_call _GrBufCpy POP BC DEC B JP NZ, moveallspritesdown1pixel
Actually, it looks like you're double buffering instead of clearing the screen. You can do that too with a few modifications.
LD B, *number to slow things down with*Loop: LD A, 1 ; Some random dummy instruction djnz Loop
Nops can slow it down a bit.
ld bc, numberLoop: dec bc ld a, b or c jr nz, Loop
LD A, (slowfactor) ; lets me change the delay during the routine. Loading 255 will be the slowest LD B, A ; speed, while loading 0 will be the fastest.lowerspeed1: CALL lowerspeed djnz lowerspeed1 -------------------------------- rest of the loop in my programm -------------------------------------lowerspeed: LD A, 8 ; Found out that with 255 in (slowfactor), doing 8 loops here gives me the slowest speeddecreasespeed: ; I want, so that I have the largest "area" to fine tune in. LD DE, 65535 ; <-- The dummie instruction DEC A cp 0 JR NZ, decreasespeed ret