Spectrum Next Basic commands - Reading the joystick and Sprite over
#spectrumnext #zxspectrum #nextbasic This is the 3rd part of things I learned programming in Next basic. %j= IN 31 will read a Next Register for a Kempston Joystick on port 1 % sprite over x,a to b,x overlap, y over lap for sprite to sprite collisions. 10 LAYER 0: CLS 20 LAYER 2,1:run at 3 30 LOAD "over.spr" BANK 15: SPRITE BANK 15: SPRITE PRINT 1 40 LET x=100: LET y=100:let s=0: let e=0 50 SPRITE 2,150,150,3,1: SPRITE 3,50,150,3,1: SPRITE 4,150,50,3,1: 60 sprite continue 2,50 to 250 step 1 run, 150 stop, 3,64,0 100 %j= IN 31 120 IF %j & BIN 00000001= BIN 00000001 THEN x=x+1 130 IF %j & BIN 00000010= BIN 00000010 THEN x=x-1 140 IF %j & BIN 00000100= BIN 00000100 THEN y=y+1 150 IF %j & BIN 00001000= BIN 00001000 THEN y=y-1 160 IF %j& BIN 00010000= BIN 00010000 THEN PRINT AT 11,10;" fire " 170 SPRITE 1,x,y,s,1 180 SPRITE MOVE INT 190 e=% SPRITE OVER (1,2 TO 4,4,0) 192 if e is greater than 0 then sprite e,0,0,0,0:s=1 (sorry no angled brackets ) 195 IF e=0 THEN s=0 200 GO TO 100 Rem
βhttps://makertube.net/w/jLqaVogqaTNruR3ZVs43YN