;pseudo code, this is not tested spr1=CreateImage (c64ispr_width,c64ispr_height)spr2=CreateImage (c64ispr_width,c64ispr_height)...setbuffer imageBuffer(spr1)c64drawsprite(nr)setbuffer imageBuffer(spr2)c64drawsprite(nr)if ImagesCollide (spr1,x,y,0,spr2,x,y,0) ;collision EndIf
;Screen (320,350,1)Graphics 320,250,32,6Graphics 320,250,32,7 ;Make the Resizeable window Include "c64sprite_inc.bb"SeedRnd MilliSecs()temp=Rand(0,1) ; Each start use a randomly choosen Palette : ;here are 2 WinVice modified palettes: If temp=1 AddPal ($00,$00,$00) ; transparent " " AddPal ($01,$00,$00) ; Black 0 AddPal ($FF,$FF,$FF) ; White 1 AddPal ($88,$20,$00) ; Red 2 AddPal ($68,$d0,$a8) ; Cyan 3 AddPal ($a8,$38,$a0) ; Purple 4 AddPal ($50,$b8,$18) ; Green 5 AddPal ($18,$10,$90) ; Blue 6 AddPal ($f0,$e8,$58) ; Yellow 7 AddPal ($a0,$48,$00) ; Orange 8 AddPal ($47,$2b,$1b) ; Brown 9 AddPal ($c8,$78,$70) ; Light Red a AddPal ($48,$48,$48) ; Dark Gray b AddPal ($80,$80,$80) ; Medium Gray c AddPal ($98,$ff,$98) ; Light Green d AddPal ($50,$90,$d0) ; Light Blue e AddPal ($b8,$b8,$b8) ; Light Gray fElse Restore paldat For x=1 To 17 Read r,g,b addpal(r,g,b) NextEndIf.paldatData $0,$0,$0, $00,$00,$01 ,$FF,$FF,$FF ,$68,$37,$2b ,$70,$a4,$b2 ,$6f,$3d,$86 ,$58,$8d,$43 ,$35,$28,$79 ,$b8,$c7,$6f ,$6f,$4f,$25 ,$43,$39,$00 ,$9a,$67,$59 ,$44,$44,$44 ,$6c,$6c,$6c ,$9a,$d2,$84 ,$6c,$5e,$b5 ,$95,$95,$95 ;To display the Template correctly, use Fixed width font, like "Courier New","Lucida Console" or "Terminal"; this is 24x21 template;X= 123456789012345678901234 v-- y;c64ds(" ",1);01 ;Template ! use overwrite mode to draw inside "";C64DS(" ") ;02 ;,1 Starts a new sprite drawing;c64ds(" ") ;03 ;if the whole line is transparent, you can use " " instead;c64ds(" ") ;04;c64ds(" ") ;05;c64ds(" ") ;06;c64ds(" ") ;07;c64ds(" ") ;08;c64ds(" ") ;09;c64ds(" ") ;10;c64ds(" ") ;11;c64ds(" ") ;12;c64ds(" ") ;13;c64ds(" ") ;14;c64ds(" ") ;15;c64ds(" ") ;16;c64ds(" ") ;17;c64ds(" ") ;18;c64ds(" ") ;19;c64ds(" ") ;20;c64ds(" ") ;21.againFor z=1 To 1 ;Increase this to 250 or 500 to test multiple sprite pages (will be 250*10 sprites in this case!) temp=(temp+1) Mod 10 ;make the program responsive, while reading data (for large for z= loop !) If temp=1 Then Delay 2 ;Theese are test sprites, with added pixels, to see if they were drawn correctly c64ds (" ffffffffffffffffffff ");1 c64ds (" ");2 c64ds (" 111111111111111111 ");3 c64ds (" 1 1 ");4 c64ds (" 1 1 ");5 c64ds (" 1 2222 2222 1 ");6 c64ds (" 1 2 2 222222 1 ");7 c64ds (" 1 2 77 2 222222 1 ");8 c64ds (" 1 2 2 222222 1 ");9 c64ds (" 1 2222 2222 1 ");10 c64ds (" 1 1 ");11 c64ds (" 1 1 ");12 c64ds (" 1 1 ");13 c64ds (" 1 1 ");14 c64ds (" 1 34 43 1 ");15 c64ds (" 1 34444444444443 1 ");16 c64ds (" 1 333333333333 1 ");17 c64ds (" 1 1 ");18 c64ds (" 1 1 ");19 c64ds (" 111111111111111111 ");20 c64ds (" ");21 c64ds ("3 3") ;1 c64ds (" ") ;2 c64ds (" 111111111111111111 ") ;3 c64ds (" 1 1 ") ;4 c64ds (" 1 1 ") ;5 c64ds (" 1 2222 2222 1 ") ;6 c64ds (" 1 2 2 2 2 1 ") ;7 c64ds (" 1 2 77 2 2 77 2 1 ") ;8 c64ds (" 1 2 2 2 2 1 ") ;9 c64ds (" 1 2222 2222 1 ") ;10 c64ds (" 1 1 ") ;11 c64ds (" 1 1 ") ;12 c64ds (" 1 1 ") ;13 c64ds (" 1 1 ") ;14 c64ds (" 1 34 43 1 ") ;15 c64ds (" 1 34444444444443 1 ") ;16 c64ds (" 1 333333333333 1 ") ;17 c64ds (" 1 1 ") ;18 c64ds (" 1 1 ") ;19 c64ds (" 111111111111111111 ") ;20 c64ds ("3 3") ;21 c64ds (" 3333333 ");1 c64ds (" 33333333333 ");2 c64ds (" 3333333333333 ");3 c64ds (" 33333 33333 ");4 c64ds (" 33333 333 333 ");5 c64ds (" 33333 333 33333 ");6 c64ds ("4 33333 333 333 5");7 c64ds ("4 33333 33333 6");8 c64ds (" 3333333333333 7");9 c64ds (" 3333333333333 ");10 c64ds (" 3 333333333 3 ");11 c64ds (" 3 3333333 3 ");12 c64ds (" 3 33333 3 ");13 c64ds (" 3 333 3 ");14 c64ds (" 3 333 3 ");15 c64ds (" 3 3 3 ");16 c64ds (" 3 3 3 ");17 c64ds (" 33333 ");18 c64ds (" 33333 ");19 c64ds (" 33333 ");20 c64ds (" 333 ");21 Restore spr For x=1 To 63 ;Multicolor sprite data Read dat c64datspr(dat,0,2,5,8) Next For y=1 To 3 ;There are 3 sprite animations to read ;testc=Rand(2,c64ipalcount) ;Random color testc=2 ;Fixed color (here 2 - white) For x=1 To 63 ;Read 1 sprite data Read dat c64datspr(dat,x<2,testc) ;x<2 here makes 1, if x is less than 2, or 0, if x is greater number Next Next ;y c64ds ("111111111111111111111111");1 c64ds ("222221222222222222222222");2 c64ds ("333333233333333333333333");3 c64ds ("444444434444444444444444");4 c64ds ("555555554555555555555555");5 c64ds ("666666666566666666666666");6 c64ds ("777777777767777777777777");7 c64ds ("888888888887888888888888");8 c64ds ("999999999999899999999999");9 c64ds ("aaaaaaaaaaaaa9aaaaaaaaaa");10 c64ds ("abbbbbbbbbbbbbabbbbbbbba");11 c64ds ("accccccccccccccbccccccca");12 c64ds ("ddddddddddddddddcddddddd");13 c64ds ("eeeeeeeeeeeeeeeeedeeeeee");14 c64ds ("ffffffffffffffffffefffff");15 c64ds ("gggggggggggggggggggfgggg");16 - Unused palette entries are drawn as transparent pixels ! c64ds ("hhhhhhhhhhhhhhhhhhhhghhh");17 c64ds ("iiiiiiiiiiiiiiiiiiiiihii");18 c64ds ("jjjjjjjjjjjjjjjjjjjjjjij");19 c64ds ("kkkkkkkkkkkkkkkkkkkkkkkj");20 c64ds ("llllllllllllllllllllllll");21 c64ds ("cc bbbbbbb cd");1 c64ds ("cc bbbbbbbbbbb cd");2 c64ds ("cc bbbbbbbbbbbbb cd");3 c64ds ("cc bbbbb bbbbb cd");4 c64ds ("cc bbbbb bbb bbbb cd");5 c64ds ("cc bbbbb bbb bbbbb cd");6 c64ds ("cc bbbbb bbb bbbb cd");7 c64ds ("cc bbbbb bbbbb cd");8 c64ds ("cc bbbbbbbbbbbbb cd");9 c64ds ("cc bbbbbbbbbbbbb cd");10 c64ds ("cc b bbbbbbbbb b cd");11 c64ds ("cc b bbbbbbb b cd");12 c64ds ("cc b bbbbb b cd");13 c64ds ("cc b bbb b cd");14 c64ds ("cc b bbb b cd");15 c64ds ("cc b b b cd");16 c64ds ("cc b b b cd");17 c64ds ("cc bbbbb cd");18 c64ds ("cc bbbbb cd");19 c64ds ("cc bbbbb cd");20 c64ds ("cc bbb cd");21 c64ds (" ccccccc ");1 c64ds (" ccccccccccc ");2 c64ds (" ccccccccccccc ");3 c64ds (" cccc cccccc ");4 c64ds (" cccc cccc cccc ");5 c64ds (" cccc cccccccccc ");6 c64ds ("4 cccc cccc cccc 5");7 c64ds ("4 cccc cccccc 6");8 c64ds (" ccccccccccccc 7");9 c64ds (" ccccccccccccc ");10 c64ds (" c ccccccccc c ");11 c64ds (" c ccccccc c ");12 c64ds (" c ccccc c ");13 c64ds (" c ccc c ");14 c64ds (" c ccc c ");15 c64ds (" c c c ");16 c64ds (" c c c ");17 c64ds (" ccccc ");18 c64ds (" ccccc ");19 c64ds (" ccccc ");20 c64ds (" ccc ");21Nextc64_finalize()SetBuffer BackBuffer()Clsx=0For tmp.c64sprmap = Each c64sprmap x=x+1 If tmpimage >0 DrawBlock tmpimage,0,0 EndIf Delay 10 Color $0,$ff,$ff Text 0,30,"Bitmap number "+x Text 0,45,"Press any key to show next" Flip WaitKey() ClsNextFlushKeys()x=0Print "Bitmap Listing:"For tmp.c64sprmap = Each c64sprmap x=x+1 Print "Image number ="+x+" IMG Handle="+tmpimageNexty=0FlipWaitKey()SetBuffer BackBuffer()animtimer=MilliSecs()Repeat If dir=0 cfl#=(cfl#+0.1) : If cfl#=>50 Then dir=1 Else cfl#=(cfl#-0.1) : If cfl#<=0 Then dir=0 EndIf Cls c=0 For py=0 To GraphicsHeight() Step 10 c=(c+1) Mod 2 For px=0 To (GraphicsWidth()*0.80) Step 10 c=(c+1) Mod 2 If c=1 Then Color $50-cfl#,$0,$0 If c=0 Then Color $0,$50+cfl#,$50+cfl# Rect px,py,10,10,1 Next Next Color $ff,$ff,$0 Text 40,10,"Mice Party - ESCape it" If MilliSecs()-animtimer>250 animtimer=MilliSecs() y=(y+1) Mod 3 s=(s+1) Mod 2 t#=(t#+1.5) Mod 60 EndIf x=(x+1) : If x>350 Then x=-120 c64drawsprite(4+y,x,80) c64drawsprite(4+y,x+c64ispr_width ,120+(t#)) c64drawsprite(4+y,x+(c64ispr_width*2),110-(t#)) c64drawsprite(4+y,x+(c64ispr_width*3),120+(t#)) c64drawsprite(4+y,x+(c64ispr_width*4),110-(t#)) c64drawsprite(0+s,10,10) six#=(six#+0.5) Mod 360 siy#=(siy#-0.9) Mod 360 c64drawsprite(2,100+Cos(six#)*106,100+Sin(six#)*60) c64drawsprite(8,50+Cos(siy#)*66,50+Sin(six#)*60) c64drawsprite(9,150+Cos(six#)*66,50+Sin(siy#)*60) c64drawsprite(7,150+Tan(six#)*66,50+Tan(siy#)*10) Flip Delay 1 Until KeyHit(1)End.spr;this is the format which is used To draw one sprite: 21 * 3 bytes - here hexadecimal numbers;1 multicolored sprite;c64imaxdrawx=3 in each row of the Sprite. 3*8= c64ispr_width=24 Data $AA,$55,$FFData $AA,$55,$FFData $AA,$55,$FFData $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $82,$41,$C3Data $AA,$55,$FFData $AA,$55,$FFData $AA,$55,$FF;3 images of;dancing mouse from <a href="http://www.zimmers.net/cbmpics/cbm/c64/c64prg.txt" target="_blank">http://www.zimmers.net/cbmpics/cbm/c64/c64prg.txt</a> (here with correct data statemens !)Data 30,0,120,63,0,252,127,129,254,127,129,254,127,189,254,127,255,254,63,255,252,31,187,248,3,187,192,1,255,128,3,189,192,1,231,128,1Data 255,0,31,255,0,0,124,0,0,254,0,1,199,32,3,131,224,7,1,192,1,192,0,3,192,0Data 30,0,120,63,0,252,127,129,254,127,129,254,127,189,254,127,255,254,63,255,252,31,221,248,3,221,192,1,255,128,3,255,192,1,195Data 128,1,231,3,31,255,255,0,124,0,0,254,0,1,199,0,7,1,128,7,0,204,1,128,124,7,128,56,30,0,120,63,0,252,127,129,254,127,129,254,127,189Data 254,127,255,254,63,255,252,31,221,248,3,221,192,1,255,134,3,189,204,1,199,152,1,255,48,1,255,224,1,252,0,3,254,0Data 7,14,0,204,14,0,248,56,0,112,112,0,0,60,0
; User32.decls .lib "user32.dll"api_GetSystemMetrics% (nIndex%) : "GetSystemMetrics"api_GetActiveWindow%():"GetActiveWindow"api_GetDC% (hwnd%) : "GetDC"api_GetDesktopWindow% () : "GetDesktopWindow"api_MoveWindow% (hwnd%, x%, y%, nWidth%, nHeight%, bRepaint%) : "MoveWindow";; GDI32.decls.lib "gdi32.dll"api_GetDeviceCaps% (hdc%, nIndex%) : "GetDeviceCaps"
If mode=0 ;F1 ;Screen (320,240,1) Graphics 320,240,0,6 Graphics 320,240,0,7EndIfIf mode=1 Then Graphics 640,480,16,0 ;F2If mode=2 Then Graphics 640,480,32,0 ;F3If mode=3 ;F4 ;Screen(320,240,2) Graphics 640,480,32,6 Graphics 320,240,32,7EndIfIf mode=4 ;F5 ;Screen(320,240,-1) Graphics 1024,960,32,6 Graphics 320,240,32,7End IfSW=GraphicsWidth()SH=GraphicsHeight()If mode=5 Then ;F6 ;SW=api_GetSystemMetrics(0) ;SH=api_GetSystemMetrics(1) ;bits=api_GetDeviceCaps(api_GetDC( api_GetDesktopWindow()),12) SW=1680 SH=1050 bits=32 Graphics SW,SH,bits,0EndIf
Include "c64sprite_inc.bb"
Graphics 640,480,0,6Graphics 640,480,0,7SetBuffer BackBuffer()introtime=MilliSecs()Global TxtY=-2mode=4intro_time=15000 ;15000milisecons = 15 secRepeat Cls Color $ff,$ff,$ff TextY (-2," Asteroids !") TextY (1,"Your spaceship is ready to harvest some nearby Asteroids.") TextY (0,"The Yellow collored contains alot of Gold,") TextY (0,"but they are rarer than the Silber Asteroids, which are indestructible.") TextY (1,"Gameplay:") TextY (0," Arrowkeys move the Ship left and right") TextY (0," Strg Fires the laser.") TextY (1,"Ingame Keys: F1/F2 changes the game version") TextY (0," Version 2 - Gray Asteroids need 3 hits") Color $ff,$50,$50 TextY (2,"Please choose a game resolution:") Color $ff,$ff,$ff TextY (1,"F1 - 320,240 windowed mode (original)") TextY (0,"F2 - 640,480 16bit -Fullscreen - not scaled") TextY (0,"F3 - 640,480 32bit -Fullscreen - not scaled") TextY (0,"F4 - Windowed - double size ") TextY (0,"F5 - Windowed - fullscreen") TextY (0,"F6 - Fullscreen - Desktop Resolution") TextY (0,"If the game is too slow, try switching between 16 and 32bits") TextY (3,"Original Game is from C64") TextY (0,"Source/Author: Unknown to me. From year 1990/1991") TextY (0,"Using original sprites.") TextY (5,"The Game is autostarting in :"+Floor((intro_time-(MilliSecs()-Introtime))*0.001)+" seconds") TextY (0,"Default Resolution F"+(mode+1)) If KeyDown(59) Then mode=0 : Exit If KeyDown(60) Then mode=1 : Exit If KeyDown(61) Then mode=2 : Exit If KeyDown(62) Then mode=3 : Exit If KeyDown(63) Then mode=4 : Exit If KeyDown(64) Then mode=5 : Exit Flip (1)Until MilliSecs()-introtime=>intro_timeIf mode=0 ;F1 Screen (320,240,1) ;Graphics 320,240,0,6 ;Graphics 320,240,0,7EndIfIf mode=1 Then Graphics 640,480,16,0 ;F2If mode=2 Then Graphics 640,480,32,0 ;F3If mode=3 ;F4 Screen(320,240,2) ;Graphics 640,480,32,6 ;Graphics 320,240,32,7EndIfIf mode=4 ;F5 Screen(320,240,-1) ;Graphics 1024,960,32,6 ;Graphics 320,240,32,7End IfSW=GraphicsWidth()SH=GraphicsHeight()If mode=5 Then ;F6 SW=api_GetSystemMetrics(0) SH=api_GetSystemMetrics(1) bits=api_GetDeviceCaps(api_GetDC( api_GetDesktopWindow()),12) ;SW=1680 ;SH=1050 ;bits=32 Graphics SW,SH,bits,0EndIfSeedRnd MilliSecs()Include "c64sprite_inc.bb"Font=LoadFont("Courier",10,False,False,False)SetFont font Restore paldatFor x=1 To 17 Read r,g,b addpal(r,g,b)Next.paldat;Data $0,$0,$0, $00,$00,$01 ,$FF,$FF,$FF ,$68,$37,$2b ,$70,$a4,$b2 ,$6f,$3d,$86 ,$58,$8d,$43 ,$35,$28,$79 ,$b8,$c7,$6f ,$6f,$4f,$25 ,$43,$39,$00 ,$9a,$67,$59 ,$44,$44,$44 ,$6c,$6c,$6c ,$9a,$d2,$84 ,$6c,$5e,$b5 ,$95,$95,$95 ;16colorsData $00,$00,$00, $01,$00,$00, $FF,$FF,$FF, $88,$20,$00, $68,$d0,$a8, $a8,$38,$a0, $50,$b8,$18, $18,$10,$90, $f0,$e8,$58, $a0,$48,$00, $47,$2b,$1b, $c8,$78,$70, $48,$48,$48, $80,$80,$80, $98,$ff,$98, $50,$90,$d0, $b8,$b8,$b8 ;16colorsRestore sprFor y=1 To 3 ;There are 3 sprites to read If y=2 And yr=0 Then Restore spr For x=1 To 63 ;Read 1 sprite data Read dat If y=1 Then c64datspr(dat,0,$c,$d,2) ;Asteroid - Gray If y=2 Then c64datspr(dat,0,10,9,8) ;Asteroid - Yellow If y=3 Then c64datspr(dat,0,$c,$d,2) ;Ship Next Next ;yc64_finalize() ;No more sprites, its save them to a bitmap !Global scratch%=CreateImage(SW,SH) ; create a scratch image -for DrawSizeImageGlobal Score=0,HiScore1=0,HiScore2=0Global asteroidcount=6 ;Maximum asteroids on screenGlobal SpawnDelay=450 ;Spawn a new Asteroid after this delay (it limits the ammount of active asteroids !)Global YellowDelay=1000 ;wait this long, until yellow asteroid is spawnedGlobal gametyp=0Global AsteroidTimer=MilliSecs()Global asteroidactive=0Global YellowTimer=MilliSecs()Global Framer=CreateTimer (75)Global version=1Type ship Field x# Field y# Field shot Field bulletX# Field bulletY#End TypeType asteroid Field x# Field y# Field speed# Field typ Field hpEnd Typeplayer.ship = New ship;Set sprite data for ImagesCollidespr_ship=CreateImage(24,21)SetBuffer ImageBuffer(spr_ship)c64drawsprite(2)spr_asteroid=CreateImage(24,21)SetBuffer ImageBuffer(spr_asteroid)c64drawsprite(0)spr_laser=CreateImage(2,10)SetBuffer ImageBuffer(spr_laser)Color $50,$Ff,$ffRect 0,0,2,10,1Color $ff,$ff,$ffGlobal img_backbuffer=CreateImage(320,240) GW=(GraphicsWidth()/2)-160 GH=(GraphicsHeight()/2)-160;Main Loop starts hereRepeat SetBuffer ImageBuffer(img_backbuffer) Gosub drawscreen ;Redraw the screen Gosub spawnasteroid Gosub game ;Draw the Gamescreen to the Backbuffer SetBuffer BackBuffer() Cls If mode=1 Or mode=2 Or mode=5 Or mode=6 DrawSizeImage(img_backbuffer,0,0,SW,SH) Color $ff,$ff,$ff ;Rect GW-1,GH-1 ,321,241,0 Else DrawImage img_backbuffer,0,0 EndIf WaitTimer(Framer) Flip (0)Until KeyDown(1)FreeTimer FramerFreeImage scratch%FreeImage img_backbufferFreeImage Spr_ShipFreeImage Spr_End.game If gametyp=0 Or gametyp=3 Or gametyp=4 If KeyDown(59) Then version=1 If KeyDown(60) Then version=2 EndIf Select gametyp Case 0 ;Press fire to start Text 20,100,"Press button to start" Text 50,160,"F1/F2 - V1/V2" If (KeyDown(157) Or KeyDown(29)) gametyp=1 FlushKeys() EndIf Case 1 ;User has pressed fire, clear starfield If asteroidactive=0 gametyp=2 Gosub initialize EndIf Case 2 ;Starfield is clear, start the game If KeyDown(205) And playerx<197 Then playerx=playerx+1 If KeyDown(203) And playerx>0 Then Playerx=playerx-1 If (KeyDown(157) Or KeyDown(29)) And playershot=0 playershot=1 playerulletx#=playerx#+10 playerullety#=playery# EndIf c64drawsprite(2,playerx#,playery#) Case 3 ;Game Over If KeyDown(157) Or KeyDown(29) ;Still holding the keys ? Else gametyp=4 EndIf Case 4 If (KeyDown(157) Or KeyDown(29)) gametyp=1 EndIf End SelectReturn .spawnasteroidIf (MilliSecs()-AsteroidTimer>SpawnDelay) And gametyp<>1 AsteroidTimer=MilliSecs() If MilliSecs()-YellowTimer>YellowDelay ;delay for the yellow asteroid If yellowactive=0 spawnyellow=1 EndIf EndIf If asteroidactive<asteroidcount ;Spawn Gray asteroids asteroid.asteroid = New asteroid asteroidx#=Rand(1,199) asteroidy#=-21 asteroidhp=3 If spawnyellow=0 asteroid yp=0 Else asteroid yp=1 yellowactive=1 spawnyellow=0 EndIf asteroidactive=asteroidactive+1 asteroidspeed#=Rnd(0.8,2) EndIf EndIfReturn.initializeplayerx=98playery=215Score=0FlushKeys()AsteroidTimer=MilliSecs()YellowTimer=MilliSecs()yellowactive=0 spawnyellow=0Return.drawscreen;is where all the action is !ClsC64color(2);Line 220,0,220,240;Text 1,1,MilliSecs()-AsteroidTimer;Text 1,14,asteroidactiveColor $3,$3,$3Rect 220,0,100,240,1Color $ff,$ff,$ffText 230,40,"Asteroids!"If version=2 Text 250,55,"V 2.0" Text 220,110,"HiScore:"+addzero(HiScore2,4)Else Text 250,55,"V 1.0" Text 220,110,"HiScore:"+addzero(HiScore1,4)EndIfText 222,90,"Score:"+addzero(Score,4)Text 230,152,"Written by"Text 230,174,"Dan / 2016"If playershot=1 Then playerullety#=playerullety#-2.5 DrawImage spr_laser,playerulletx#,playerullety#,0 If playerullety#=-15 playerulletx#=-10 playershot=0 EndIfEndIfFor tmp.asteroid = Each asteroid tmpy#=tmpy#+tmpspeed# c64drawsprite (tmp yp,tmpx#,tmpy#) If ImagesCollide(spr_ship,playerx#,playery#,0,spr_asteroid,tmpx#,tmpy#,0) And gametyp=2 ;Player Asteroid collision gametyp=3 EndIf If ImagesCollide(spr_laser,playerulletx#,playerullety#,0,spr_asteroid,tmpx#,tmpy#,0) ;Collision detection - bullet + asteroid playerulletx#=-20 playershot=0 If tmp yp=1 Delete tmp If version=1 Score=Score+1 If Score>HiScore1 Then HiScore1=Score Else Score=Score+10 If Score>HiScore2 Then HiScore2=Score EndIf asteroidactive=asteroidactive-1 spawnyellow=0 yellowactive=0 YellowTimer=MilliSecs() Goto ext EndIf If version=2 tmphp=tmphp-1 If tmphp<=0 Score=Score+4 asteroidactive=asteroidactive-1 Delete tmp Goto ext EndIf EndIf EndIf If tmpy#>244 ;If Asteroid is offscreen: If tmp yp=1 spawnyellow=0 yellowactive=0 YellowTimer=MilliSecs() EndIf Delete tmp asteroidactive=asteroidactive-1 EndIf .extNextIf gametyp=3 Or gametyp=4 Text 55,100,"Game Over" Text 20,130,"Press button to Start" Text 50,160,"F1/F2 - V1/V2"EndIfReturn.spr;asteroidData $00,$FF,$00,$07,$F5,$40,$1F,$E9,$D0,$AF,$AE,$50,$3E,$EB,$94,$7E,$BA,$94,$BF,$99,$A4Data $FA,$AA,$95,$EA,$BA,$65,$FB,$9A,$95,$FD,$AE,$A5,$EA,$B9,$95,$FA,$AA,$65,$FB,$99,$A5Data $BD,$AA,$94,$7E,$E6,$54,$3A,$6A,$94,$2F,$A5,$50,$1E,$95,$50,$07,$D5,$40,$01,$55,$00;shipData $00,$20,$00,$00,$70,$00,$00,$E4,$00,$00,$E4,$00,$01,$E4,$00,$02,$E5,$00,$03,$A9,$00Data $03,$A9,$00,$07,$A9,$00,$1F,$A9,$40,$7E,$BA,$50,$BA,$C6,$94,$EB,$11,$A4,$ED,$20,$64Data $EC,$74,$64,$EC,$20,$64,$EB,$11,$A4,$FA,$46,$94,$3E,$AA,$50,$05,$55,$40,$03,$4D,$00Function addzero$(var, showcount);shorter code by bobysait If showcount=1 Return Right$(var,1) Else Return String("-", Sgn(var)<0)+Replace(RSet(Abs(var), (showcount-(Sgn(var)<0)))," ","0"); EndIfEnd FunctionFunction TextY (num,txt$);Num = How many columns to skip;Replaces Print with Text;Every Function call displays the text;1 line under the old one, like calling;multiple print statements after eachother.;; Set num to -2 to make the text go on top (like locate 0,0); Use the Global TxtY=-2 outside this function;;Global TxtY=-2 ;Make TxtY global variable for displaying help text If num=-2 TxtY=0 Else TxtY=TxtY+(FontHeight()*(num+1)) EndIf Text 0,TxtY,txt$End Function Function DrawSizeImage(image,x%,y%,w%,h%);Global scratch%=CreateImage(SW,SH) ; create a scratch image Local ih%=ImageHeight(image) Local iw%=ImageWidth(image) Local sw%=Abs(w) Local sh%=Abs(h) Local xr#=(Float(iw)/Float(sw)) Local yr#=(Float(ih)/Float(sh)) fromimg=ImageBuffer(image) toimg=ImageBuffer(scratch) Local vf=-1+((h>0)*2) Local fw=(w<0)*w Local fh=(h<0)*h If w>=0 For ix=0 To sw CopyRect ix*xr,0,1,ih,ix,0,fromimg,toimg Next Else For ix=0 To sw CopyRect ix*xr,0,1,ih,sw-ix,0,fromimg,toimg Next EndIf For iy=0 To sh CopyRect 0,iy*yr,sw,1,x+fw,y+(iy*vf),toimg NextEnd FunctionFunction Screen(x,y,full=0);fill <0 = Fulldesktop, borderless window;full =0 = Fulldesktop ;full =1 = original x,y;full >1-5 = x*full,y*full size;full >5 = 0 DeskX=api_GetSystemMetrics(0) DeskY=api_GetSystemMetrics(1) If x>DeskX Then x=DeskX If x<64 Then x=64 If y>DeskY Then y=DeskY If y<64 Then y=64 bits=api_GetDeviceCaps(api_GetDC( api_GetDesktopWindow()),12) Graphics x,y,bits,6 Graphics x,y,bits,7 If full<=0 Or full>5 If full<0 Then api_SetWindowLong(api_GetActiveWindow(), -16, $10000000) api_MoveWindow(api_GetActiveWindow(),0,0,DeskX,DeskY,True) EndIf If full>1 And full<=5 Then api_MoveWindow(api_GetActiveWindow(),0,0,x*full,y*full,True)End Function