'=========================================================================== ' Subject: SIMPLE SPRITE/PAINT PROGRAM Date: 07-27-98 (20:16) ' Author: Richard Stanway Code: QB, QBasic, PDS ' Origin: rich@acorn.win-uk.com Packet: GRAPHICS.ABC '=========================================================================== SCREEN 13 PRINT "Please select you work area options now." INPUT "FILENAME: ", filename$ IF NOT filename$ = "" THEN GOTO loadafilegoddamnit redo: INPUT "X2: ", workx2 INPUT "Y2: ", worky2 IF workx2 > 150 OR worky2 > 150 THEN BEEP: PRINT "150 pixels maximum": PRINT : GOTO redo CLS hadesishere: LINE (workx1, worky1)-(workx2, worky2), 10, B x = INT(workx2 / 2 + workx1 / 2) y = INT(worky2 / 2 + worky1 / 2) oldcol = 0 col = 15 DO t$ = INKEY$ IF t$ <> "" THEN PSET (x, y), oldcol IF t$ = CHR$(0) + "H" THEN y = y - 1 IF t$ = CHR$(0) + "P" THEN y = y + 1 IF t$ = CHR$(0) + "K" THEN x = x - 1 IF t$ = CHR$(0) + "M" THEN x = x + 1 IF t$ = "t" THEN cons = NOT cons IF t$ = "c" THEN GOSUB changecol IF t$ = "s" THEN GOSUB save IF t$ = "r" THEN GOSUB save: GOSUB resize IF t$ = CHR$(27) THEN GOSUB save: END oldcol = POINT(x, y) IF t$ = "e" THEN oldcol = 0 IF t$ = " " OR cons = -1 THEN oldcol = col PSET (x, y), col END IF LOOP changecol: oldx = x oldy = y oldoldcol = oldcol 'OPEN "n:tmp.tmp" FOR OUTPUT AS #1 'WRITE #1, workx1, workx2, worky1, worky2 'FOR i% = workx1 + 1 TO workx2 - 1 'FOR h% = worky1 + 1 TO worky2 - 1 'o% = POINT(i%, h%) 'WRITE #1, o% 'NEXT h% 'NEXT i% ' ' 'CLOSE FOR i = 1 TO 255 PSET (i, 140), i NEXT i FOR i = 32 TO 103 PSET (i, 141), i NEXT i FOR i = 32 TO 103 PSET (i, 142), i + 72 NEXT i FOR i = 32 TO 103 PSET (i, 143), i + 144 NEXT i BEEP IF oldpaly = 0 THEN oldpaly = 140 IF oldpalx = 0 THEN oldpalx = col y = oldpaly oldcol = col x = oldpalx DO t$ = INKEY$ IF t$ <> "" THEN PSET (x, y), oldcol IF t$ = CHR$(0) + "H" THEN y = y - 1 IF t$ = CHR$(0) + "P" THEN y = y + 1 IF t$ = CHR$(0) + "K" THEN x = x - 1 IF t$ = CHR$(0) + "M" THEN x = x + 1 IF t$ = "c" AND NOT POINT(x, y) = 0 THEN EXIT DO oldcol = POINT(x, y) LOCATE 19, 1: PRINT POINT(x, y); " " LINE (1, 180)-(20, 200), POINT(x, y), BF PSET (x, y), col END IF LOOP col = POINT(x, y) oldpalx = x oldpaly = y x = oldx y = oldy oldcol = oldoldcol BEEP RETURN loadafilegoddamnit: CLS OPEN filename$ FOR APPEND AS #1 IF LOF(1) < 2 THEN CLOSE #1: KILL filename$: GOTO redo CLOSE #1 OPEN filename$ FOR INPUT AS #1 INPUT #1, workx1, workx2, worky1, worky2 FOR i% = workx1 + 1 TO workx2 - 1 FOR h% = worky1 + 1 TO worky2 - 1 INPUT #1, g% PSET (i%, h%), g% NEXT h% NEXT i% SOUND 2500, 1 CLOSE GOTO hadesishere save: OPEN filename$ FOR OUTPUT AS #1 WRITE #1, workx1, workx2, worky1, worky2 FOR i% = workx1 + 1 TO workx2 - 1 FOR h% = worky1 + 1 TO worky2 - 1 o% = POINT(i%, h%) WRITE #1, o% NEXT h% NEXT i% CLOSE BEEP RETURN resize: LINE (workx1, worky1)-(workx2, worky2), 0, B LOCATE 15, 30: PRINT "OLD X2"; workx2 LOCATE 16, 30: PRINT "OLD Y2"; worky2 LOCATE 18, 30: INPUT "NEW X2 ", workx2 LOCATE 19, 30: INPUT "NEW Y2 ", worky2 GOSUB save CLS GOSUB loadafilegoddamnit