Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fourspriter: Sprite Engine from the Mojon Twins
#2
Here goes a small example to see it working. It's really fast Smile

Code:
#include <sinclair.bas>
#include <memcopy.bas>
#include <keys.bas>


100 DIM gentle (0 to 3,0 to 7) AS uByte => {  { 15, 15, 15, 15, 15, 15, 13, 15} , _
      { 240, 144, 208, 208, 240, 240, 176, 240} , _
      { 15, 14, 63, 0, 0, 12, 26, 30} , _
      { 176, 112, 252, 0, 0, 48, 104, 120}}

110 POKE Uinteger 23675, @gentle(0,0)


    memcopy (0,16384,4092)
    LET gx=10:LET gy=10:let dx=3:let dy=3:let tx=6:let ty=6:let cx=18:let cy=18
    let dmx=1:let dmy=1:let tmx=-1:let tmy=-1:let cmx=1:let cmy=-1
    fsprite (0,0,1,2,3)
    fspritecoord (0,gy,gx)
    fsprite (1,0,1,2,3)
    fspritecoord (1,dy,dx)
    fsprite (2,0,1,2,3)
    fspritecoord (2,ty,tx)
    fsprite (3,0,1,2,3)
    fspritecoord (3,cy,cx)
    fspriteattr (0,31,31,31,31)
    fspriteattr (1,12,12,12,12)
    fspriteattr (2,26,26,26,26)
    fspriteattr (3,6,6,6,6)
gosub   initsprites
gosub drawsprites
gosub updatecoordinates

bucle:

    IF MULTIKEYS(KEYO)<>0 and gx>0 THEN LET gx=gx-1: END IF
    IF MULTIKEYS(KEYP)<>0 and gx<30 THEN LET gx=gx+1:END IF
    IF MULTIKEYS(KEYQ)<>0 and gy>0 THEN LET gy=gy-1 :END IF
    IF MULTIKEYS(KEYA)<>0 and gy<22 THEN LET gy=gy+1: END IF


    let dx=dx+dmx:if dx=0 or dx=30 then let dmx=-dmx : END IF
    let dy=dy+dmy:if dy=0 or dy=22 then let dmy=-dmy: END IF
    let tx=tx+tmx:if tx=0 or tx=30 then let tmx=-tmx: END IF
    let ty=ty+tmy:if ty=0 or ty=22 then let tmy=-tmy: END IF
    let cx=cx+cmx:if cx=0 or cx=30 then let cmx=-cmx: END IF
    let cy=cy+cmy:if cy=0 or cy=22 then let cmy=-cmy: END IF
pause 2
gosub borrasprites
    fspritecoord (0,gx,gy)
    fspritecoord (1,dx,dy)
    fspritecoord (2,tx,ty)
    fspritecoord (3,cx,cy)
gosub   initsprites
gosub drawsprites
gosub updatecoordinates

goto bucle

end
#include <fourspriter.bas>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)