I'm still trying to write my high-rez game and I'd need some help.
At least one part of the game should have a scrolling background.
So i set up 3 screens:
Screen (Xbios 2), scrn1 and scrn2
the player is in a string - lizz$
i managed to create a horizontal scrollscreen with RC_COPY
it scrolls 2 pixels to the left, then i put the player " block" its about 200*200 big.
This way, it's verry slow, but what is even worse - heavy flickering - and the controls ( l -move right, J - move left) don't really work. there is latency...
At the moment, the code looks like that:
- Code: Tout sélectionner
INLINE lizz%,32034
INLINE lizzm%,32034
INLINE house%,32034
INLINE house1%,32034
INLINE house2%,32034
!
screen=XBIOS(2)
s1$=SPACE$(32256)
scrn1=(INT(VARPTR(s1$)/256)+1)*256
s2$=SPACE$(32256)
scrn2=(INT(VARPTR(s2$)/256)+1)*256
!
! ----G_MASK_LIZZ---
~XBIOS(5,L:scrn1,L:-1,-1)
BMOVE lizzm%+34,scrn1,32000
GET 0,0,192,192,lizzm1$
GET 197,0,528,191,lizzm2$
GET 0,205,308,399,lizzm3$
GET 190,400,639,399,lizzm4$
!------G_LIZZ--------
~XBIOS(5,L:scrn2,L:-1,-1)
BMOVE lizz%+34,scrn2,32000
GET 0,0,192,192,lizz1$
GET 197,0,528,191,lizz2$
GET 0,205,308,399,lizz3$
GET 190,400,639,399,lizz4$
!
!---------BACKGROUND_HOUSE-----------------
~XBIOS(5,L:screen,L:-1,-1)
BMOVE house%+34,screen,32000
BMOVE house%+34,scrn1,32000
BMOVE house1%+34,scrn2,32000
!
!--------SCROLLING----------------
sx%=0
sx1%=640
!
rx%=0
rx1%=0
rx2%=640
!
x%=0
y%=208
DO
a$=INKEY$
GOSUB scroll
sx%=sx%+2
sx1%=sx1%-2
!
rx%=rX%+2
rx1%=rx1%+2
rx2%=rx2%-2
!
GOSUB lizz
exit if sx%=640
Loop
-------CHANGE PICS-TO-SCROLL-------------------
BMOVE house1%+34,scrn1,32000
BMOVE house2%+34,scrn2,32000
sx%=0
sx1%=640
!
rx%=0
rx1%=0
rx2%=640
DO
a$=INKEY$
GOSUB scroll
sx%=sx%+2
sx1%=sx1%-2
!
rx%=rX%+2
rx1%=rx1%+2
rx2%=rx2%-2
!
GOSUB lizz
exit if sx%=640
Loop
!
END
!
!
!-----Proceduren---------
Procedure scroll
RC_COPY scrn1,sx%,0,sx1%,400 TO XBIOS(2),0,0,3
RC_COPY scrn2,rx%,0,rx1%,400 TO XBIOS(2),rx2%,0,3
RETURN
!
Procedure lizz
IF ASC(a$)=108 THEN !l- links
x%=x%+2
PUT x%,y%,lizzm1$,4
PUT x%,y%,lizz1$,6
ENDIF
IF ASC(a$)=106 THEN !j - rechts
x%=x%-2
PUT x%,y%,lizzm1$,4
PUT x%,y%,lizz1$,6
ENDIF
IF ASC(a$)=97 THEN !a - lizz2
PUT x%,y%,lizzm2$,4
PUT x%,y%,lizz2$,6
ENDIF
IF ASC(a$)=98 THEN !b - lizz3
PUT x%,y%,lizzm3$,4
PUT x%,y%,lizz3$,6
ENDIF
Return
Thats really slow and not suitable for a game...
Ok, ican make it faster when i scroll 16 pixles but the reaction to the keypress is still a problem, beside, flickering.
should i forget about fullscreenscrolling, or is there way to make it react in the right way? without flickering?
I don't know how to use swapping screens in this way. I already have 3 screens for scrolling...
- Next i would add another big block$ to PUT it from the other side of the screen. - and music. of course
then it'll be even slower i guess.
I read about the STE hardwarescrolling, and had a look at the example from paradise, but i didn't really understand it.
Is it hard to convert my code to hardwarescrolling?
Anyway i would be glad if you could give me some advice how i can make it flickerfree and reacting right to the inkey$.
regards,