09-09-2002, 06:44 PM
Oh - I should be editing... I forgot that there are people who hate double posts just kidding. Well, I found something. And I consider that it is cleaner to post it separately. It is sumthing like this:
The Editor
The SUB which draws it
Sample sprite
(Cut and paste to notepad, REMOVE THE LINE BREAKS [it should be in ONE SINGLE LINE!!] then save it as sprite.spr, and load it from the previous code) (I've broken the lines 'cause the whole thing screwed the forum layout)
Weird, isn't it?
The Editor
Code:
x% = 0
y% = 0
SCREEN 7
PRINT "Your drawing will be saved to a file."
PRINT "You may press 'S' to close the file and"
PRINT "EXIT."
INPUT "File Name"; n$
CLS
PAINT (0, 0), 15
OPEN n$ FOR OUTPUT AS #1
LINE (128, 0)-(128, 128), 0
LINE (0, 128)-(128, 128), 0
mode% = 0 ' Not Drawing
c% = 0
oc% = POINT(8 * x%, 8 * y%)
COLOR 7
LOCATE 19, 1: PRINT " MOVE:QWEDCXZA "
LOCATE 20, 1: PRINT " COL:[SHIFT]+12345670 "
LOCATE 21, 1: PRINT " ENTER:DRAW|SPACE:MOVE "
DO
IF NOT mode% THEN
LINE (8 * x%, 8 * y%)-(7 + 8 * x%, 7 + 8 * y%), oc%, BF
ELSE
LINE (8 * x%, 8 * y%)-(7 + 8 * x%, 7 + 8 * y%), c%, BF
END IF
k$ = UCASE$(INKEY$)
SELECT CASE k$
CASE "W":
IF y% > 0 THEN
IF NOT mode% THEN PRINT #1, "B";
PRINT #1, "U1";
y% = y% - 1
END IF
CASE "E":
IF y% > 0 AND x% < 15 THEN
IF NOT mode% THEN PRINT #1, "B";
PRINT #1, "E1";
y% = y% - 1
x% = x% + 1
END IF
CASE "D":
IF x% < 15 THEN
IF NOT mode% THEN PRINT #1, "B";
PRINT #1, "R1";
x% = x% + 1
END IF
CASE "C":
IF x% < 15 AND y% < 15 THEN
IF NOT mode% THEN PRINT #1, "B";
PRINT #1, "F1";
x% = x% + 1
y% = y% + 1
END IF
CASE "X":
IF y% < 15 THEN
IF NOT mode% THEN PRINT #1, "B";
PRINT #1, "D1";
y% = y% + 1
END IF
CASE "Z":
IF y% < 15 AND x% > 0 THEN
IF NOT mode% THEN PRINT #1, "B";
PRINT #1, "G1";
x% = x% - 1
y% = y% + 1
END IF
CASE "A":
IF x% > 0 THEN
IF NOT mode% THEN PRINT #1, "B";
PRINT #1, "L1";
x% = x% - 1
END IF
CASE "Q":
IF x% > 0 AND y% > 0 THEN
IF NOT mode% THEN PRINT #1, "B";
PRINT #1, "H1";
x% = x% - 1
y% = y% - 1
END IF
CASE CHR$(13):
mode% = -1
CASE " ":
mode% = 0
CASE "1" TO "7", "0": c% = VAL(k$): PRINT #1, "C" + k$;
' This is mapped for Spanish keyboard.
' These are the symbols which can be gotten pressing the
' keys 1-7 and 0 with Shift.
' Change for your keyboard layout.
CASE "!": c% = 9: PRINT #1, "C9";
CASE CHR$(34): c% = 10: PRINT #1, "C10";' ["] character = 34.
CASE "ú": c% = 11: PRINT #1, "C11";
CASE "$": c% = 12: PRINT #1, "C12";
CASE "%": c% = 13: PRINT #1, "C13";
CASE "&": c% = 14: PRINT #1, "C14";
CASE "/": c% = 15: PRINT #1, "C15";
CASE "=": c% = 8: PRINT #1, "C8";
CASE "S": EXIT DO ' GOTO Fin, originally
END SELECT
oc% = POINT(8 * x%, 8 * y%)
IF mode% THEN
LINE (8 * x%, 8 * y%)-(7 + 8 * x%, 7 + 8 * y%), c%, BF
LINE (8 * x%, 8 * y%)-(7 + 8 * x%, 7 + 8 * y%), 15 - c%, B
ELSE
LINE (8 * x%, 8 * y%)-(7 + 8 * x%, 7 + 8 * y%), 15 - oc%, B
END IF
LOOP
Fin:
CLOSE #1
SYSTEM
The SUB which draws it
Code:
DECLARE SUB SCRPUT (x%, y%, o$)
' SPRPUT.BAS
SCREEN 7
INPUT "Sprite filename"; sp$
OPEN sp$ FOR INPUT AS #1
LINE INPUT #1, o$
PRINT "DRAW COMMAND:"
PRINT o$
PRINT : PRINT "PRESS A KEY"
SLEEP: k$ = INKEY$: CLS : PAINT (0, 0), 15
CLOSE #1
WHILE INKEY$ = ""
x% = INT(RND * 320)
y% = INT(RND * 200)
SCRPUT x%, y%, o$
WEND
SUB SCRPUT (x%, y%, o$)
PRESET (x%, y%)
DRAW o$
END SUB
Sample sprite
(Cut and paste to notepad, REMOVE THE LINE BREAKS [it should be in ONE SINGLE LINE!!] then save it as sprite.spr, and load it from the previous code) (I've broken the lines 'cause the whole thing screwed the forum layout)
Code:
BF1BF1BF1BF1BR1BR1BR1BU1BL1R1R1R1D1L1C12L1L1D1L1R1R1
R1D1L1L1U1U1C7R1C10C12R1C7F1C8D1D1C4F1F1R1L1H1H1L1
L1L1G1L1H1H1F1F1R1E1R1D1D1D1R1U1U1R1D1D1D1C2L1L1G1
G1D1D1C6L1L1R1U1R1C2U1E1E1R1R1D1D1F1R1C6R1D1U1U1
Weird, isn't it?
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i