CPCWiki forum

General Category => Programming => Topic started by: PAQUITO on 11:42, 03 October 19

Title: My roguelike in BASIC
Post by: PAQUITO on 11:42, 03 October 19
Hi everyone! I´m new in this forum. I want to share a project I´m working in. It´s a roguelike style game totally coded in Locomotive BASIC.I will be posting my advances and the most recent code so you can throw some critics, test it or whatever you feel like it.
*** SIDE NOTE *** >>> if you can code sound effects, please let me know. I´m in need of nice kabooms to replace my crappy sounds.
(https://i.postimg.cc/vZ66d65Y/Anotaci-n-2019-12-03-013137.jpg) (https://postimages.org/)post a picture (https://postimages.org/)
LATEST VERSION
This is the base game. I will be updating it by adding more features, monsters, chests, combat system, etc...last update: Sunday, november 24thCPC6128 version (DSK): http://bit.ly/35XfrQ4 (http://bit.ly/2segMmT)
Title: Re: My roguelike in BASIC
Post by: XeNoMoRPH on 13:13, 03 October 19
Welcome !!!  8)
Title: Re: My roguelike in BASIC
Post by: SpDizzy on 18:23, 03 October 19
Really welcome!!Nice to see some roguelike basic projects, maybe inspired on the series #AmstradGameDevChallenge (https://github.com/AmstradGameDevChallenge/BASICvsC-RPG) BASIC vs C?Just test it, and it looks really amazing.Please, take into account that the random generation of the level could result on undesaired situations like the one showed on attached image, where exit door is inaccesible.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 18:59, 03 October 19
Thanks! It seems to be the old code, in a later version I solved that by only generating the inside walls, leaving a clear corridor in each side of the room, so the door is always accesible. That fix will be included in the next update.
About the GameDevChallenge, this game is not inspired on it, but that video series, along with the cpctelera project is what started me for getting back to Basic coding (but I´m not using cpctelera)
Title: Re: My roguelike in BASIC
Post by: SpDizzy on 19:06, 03 October 19
Oh yes, sorry. After carefully watch the attached video, is obvious the problem is solved, and the door is always accesible. GameDevChallenge video series are so inspiring for me too, but my basic coding skills are far beyond what they used to be. Keep on the good work!!

Title: Re: My roguelike in BASIC
Post by: SRS on 20:05, 03 October 19
Nice one.
Could you try to keep it BASIC 1.0 compatible so us 464ers can play it, too ?
CLEAR INPUT could be while inkey$<>"":wend i.e.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 21:51, 03 October 19
Quote from: SRS on 20:05, 03 October 19
Nice one.
Could you try to keep it BASIC 1.0 compatible so us 464ers can play it, too ?
CLEAR INPUT could be while inkey$<>"":wend i.e.
Well, I don´t know about that Basic version. I would like to, but I would need someone proficient in 1.0 to make the changes. Anyways, you still can play it in RVM or WinApe, right?
Title: Re: My roguelike in BASIC
Post by: AMSDOS on 12:40, 04 October 19

There maybe some PRINTing complications which may lead to problems in 1.0 from the way the graphics are setup (the use of string$(2,8) & chr$(10) to move the cursor into position), though I haven't got the means to test at the moment.


The workaround for that would seem to have:


PRINT USING"&";...$


for any of those lines which handle the larger graphics. I've included some screenshots with your main character graphic to show what happens on a 464 when the PRINT USING is used and when it's not, though as I said earlier, the board size used in the game may not show.
Title: Re: My roguelike in BASIC
Post by: VincentGR on 14:48, 04 October 19
lovely!
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 14:57, 04 October 19
Quote from: AMSDOS on 12:40, 04 October 19
There maybe some PRINTing complications which may lead to problems in 1.0 from the way the graphics are setup (the use of string$(2,8) & chr$(10) to move the cursor into position), though I haven't got the means to test at the moment.


The workaround for that would seem to have:


PRINT USING"&";...$

for any of those lines which handle the larger graphics. I've included some screenshots with your main character graphic to show what happens on a 464 when the PRINT USING is used and when it's not, though as I said earlier, the board size used in the game may not show.

You seem to know about the subject. Wouldn´t you like to convert the code to 464 so the game can be released to both? You´ll be in the credits, of course.
Title: Re: My roguelike in BASIC
Post by: AMSDOS on 22:58, 04 October 19
I got up early to have a look and see, unfortunately while copying code from my mac saved to PDF, problems with the spacing occurred when transferring the text, as a result what I initially had was messed up, fortunately I was able to go back to the PDF and work out the spacing I needed when I pasted it to Notepad, but I was doing it all back to front because I'd made adjustments testing in 464 and then 6128 before realising the copying paste from PDF to Text had messed up the Spacing. I think where the code is to draw the headbanner (640 & 650) I may have put too many spaces in though.


But the only flaw I could see on the 464 was the ends of the Head Banner, which was being drawn on the Map Screen, so line 650 was adjusted using my earlier suggestion and is now working correctly. I have also made adjustments to all the other graphics which use the backspace, cursor down approach and to the ones which have ret$ as well, they appeared to be working fine, though if a larger area for the game should be used, my adjustments should work on a 464 as well.


No creditation is necessary.  8)




10 REM 8 BIT DUNGEONS
20 REM BY JNL
30 REM SEPT 2019
40 REM
50 REM INICIALIZA VARIABLES NUMERICAS
60 MODE 1:BORDER 1
70 WINDOW #2,1,26,1,25
80 planta=1:dinero=0
90 REM
100 REM DEFINE GRAFICOS
110 SYMBOL AFTER 48
120 SYMBOL 48,28,38,102,102,102,100,56,0
130 SYMBOL 49,16,56,24,24,24,24,16,0
140 SYMBOL 50,56,92,8,16,32,68,124,0
150 SYMBOL 51,124,72,16,60,12,8,16,32
160 SYMBOL 52,12,28,44,76,126,12,12,8
170 SYMBOL 53,30,36,112,56,28,12,68,56
180 SYMBOL 54,56,96,104,124,108,108,56,0
190 SYMBOL 55,124,100,8,8,16,16,48,24
200 SYMBOL 56,60,102,100,24,38,102,60,0
210 SYMBOL 57,60,102,102,110,118,38,4,24
220 SYMBOL 76,12,54,112,176,48,34,126,0
230 SYMBOL 86,68,238,102,102,102,111,50,0
240 SYMBOL 72,64,228,110,118,102,103,102,4
250 SYMBOL 80,44,246,102,102,118,236,96,240
251 SYMBOL 235,1,7,14,28,58,60,62,28
252 SYMBOL 236,224,216,220,108,240,120,184,112
260 SYMBOL 237,0,254,252,248,240,248,252,254
270 SYMBOL 238,0,127,63,31,15,31,63,127
280 SYMBOL 239,0,255,255,255,255,255,255,255
290 SYMBOL 240,1,35,119,119,113,116,115,114
300 SYMBOL 241,0,128,192,192,192,128,63,187
310 SYMBOL 242,249,6,119,15,15,15,60,30
320 SYMBOL 243,49,187,59,187,191,222,236,112
330 SYMBOL 244,85,254,255,254,255,254,255,254
340 SYMBOL 245,85,255,255,255,255,255,255,255
350 SYMBOL 246,253,170,127,255,255,255,255,127
360 SYMBOL 247,127,170,255,255,255,255,255,254
370 SYMBOL 248,83,238,217,181,181,109,125,109
380 SYMBOL 249,193,113,153,172,172,182,190,182
390 SYMBOL 250,121,102,118,105,125,109,125,109
400 SYMBOL 251,190,182,190,182,190,182,190,182
410 SYMBOL 252,31,55,59,0,59,59,59,59
420 SYMBOL 253,248,252,204,0,204,252,252,252
430 SYMBOL 254,0,0,6,73,249,6,0,0
440 REM
450 REM DEFINE VARIABLES DE LOS SPRITES
460 ret$=STRING$(2,8)+CHR$(10)
470 borr$="  "+ret$+"  "
480 guerr$=CHR$(15)+CHR$(1)+CHR$(240)+CHR$(241)+STRING$(2,8)+CHR$(10)+CHR$(242)+CHR$(243)
490 muro$=CHR$(15)+CHR$(1)+CHR$(244)+CHR$(245)+STRING$(2,8)+CHR$(10)+CHR$(246)+CHR$(247)
500 puerta$=CHR$(15)+CHR$(2)+CHR$(248)+CHR$(249)+ret$+CHR$(250)+CHR$(251)
510 cofre$=CHR$(15)+CHR$(1)+"  "+ret$+CHR$(252)+CHR$(253)
520 llave$=CHR$(15)+CHR$(2)+"  "+ret$+" "+CHR$(254)
530 cintai$=CHR$(15)+CHR$(3)+CHR$(238)+CHR$(239)
540 cintad$=CHR$(15)+CHR$(3)+CHR$(239)+CHR$(237)
541 botin$=CHR$(15)+CHR$(1)+"  "+ret$+CHR$(235)+CHR$(236)
550 REM
560 REM DIBUJA PANTALLA DE JUEGO
570 GOSUB 1070
580 FOR y=1 TO 12
590 FOR x=1 TO 13
600 IF casilla$(x,y)="*" THEN LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";muro$
610 IF casilla$(x,y)="F" THEN LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";puerta$
620 NEXT x
630 NEXT y
640 LOCATE 30,1:PAPER 3:PEN 0:PRINT "        "
650 LOCATE 29,2:PAPER 0:PEN 3:PRINT USING"&";cintai$+"      "+cintad$
660 LOCATE 31,1:PAPER 3:PEN 0:PRINT planta
670 LOCATE 28,4:PAPER 0:PRINT USING"&";guerr$
680 LOCATE 31,4:PRINT"LV 06"
690 LOCATE 31,5:PRINT"HP 128/580"
691 LOCATE 28,23:PRINT USING"&";botin$;:PRINT"x";dinero
700 REM
710 REM DECIDE POSICION ALEATORIA DE JUGADOR Y LLAVE. LOS DIBUJA
720 x=INT(RND*11)+2:y=INT(RND*10)+2
730 casilla$(x,y)="J"
740 LOCATE (x*2)-1, (y*2)-1:PEN 1:PRINT USING"&";guerr$
750 llavex=INT(RND*11)+2:llavey=INT(RND*10)+2
760 IF casilla$(llavex,llavey)<>"." THEN 750
770 casilla$(llavex,llavey)="K"
771 LOCATE (llavex*2)-1, (llavey*2)-1:PRINT USING"&";llave$
772 REM
773 REM DECIDE POSICION ALEATORIA DE COFRE Y LO DIBUJA
774 cofrex=INT(RND*11)+2:cofrey=INT(RND*10)+2
775 IF casilla$(cofrex,cofrey)<>"." THEN 774
776 casilla$(cofrex,cofrey)="C"
777 LOCATE (cofrex*2)-1, (cofrey*2)-1:PRINT USING"&";cofre$
808 REM
809 REM CALCULA OBSTACULOS AL AZAR Y LOS DIBUJA
810 FOR casillay=3 TO 10
820 FOR casillax=3 TO 11
830 IF casilla$(casillax,casillay)<>"." THEN GOTO 860
840 RANDOMIZE RND:obs=INT(RND*4):IF obs<>1 THEN GOTO 860
850 LOCATE (casillax*2)-1,(casillay*2)-1:PRINT USING"&";muro$:casilla$(casillax,casillay)="*"
860 NEXT casillax
870 NEXT casillay
880 REM
890 REM TURNO DEL JUGADOR
900 casilla$(x,y)="J":WHILE INKEY$<>"":WEND
901 a$=INKEY$:IF a$="" THEN 901
910 IF a$=CHR$(240) THEN destinox=x:destinoy=y-1:GOTO 970
920 IF a$=CHR$(241) THEN destinox=x:destinoy=y+1:GOTO 970
930 IF a$=CHR$(242) THEN destinox=x-1:destinoy=y:GOTO 970
940 IF a$=CHR$(243) THEN destinox=x+1:destinoy=y:GOTO 970
950 GOTO 901
960 REM
970 REM MOVER JUGADOR
980 IF casilla$(destinox,destinoy)="*" THEN 901
990 IF casilla$(destinox,destinoy)="F" AND llave=1 THEN 1370
1000 IF casilla$(destinox,destinoy)="F" AND llave=0 THEN 901
1001 IF casilla$(destinox,destinoy)="K" THEN llave=1:SOUND 1,150,10:SOUND 1,50,10
1002 IF casilla$(destinox,destinoy)="C" THEN 1470
1003 IF casilla$(destinox,destinoy)="$" THEN 1560
1020 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";borr$
1030 x=destinox:y=destinoy
1040 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";guerr$:SOUND 1,4000,1:SOUND 1,4000,1
1050 GOTO 900
1060 REM
1070 REM DEFINE CUADRICULA DEL MAPA
1080 DIM casilla$(14,13):DIM mapa$(12)
1090 mapa$(1)="*************"
1100 mapa$(2)="*...........*"
1110 mapa$(3)="*...........*"
1120 mapa$(4)="*...........*"
1130 mapa$(5)="*...........*"
1140 mapa$(6)="*...........*"
1150 mapa$(7)="*...........*"
1160 mapa$(8)="*...........*"
1170 mapa$(9)="*...........*"
1180 mapa$(10)="*...........*"
1190 mapa$(11)="*...........*"
1200 mapa$(12)="*************"
1210 FOR casillay=1 TO 12
1220 FOR casillax=1 TO 13
1230 casilla$(casillax,casillay)=MID$(mapa$(casillay),casillax,1)
1240 NEXT casillax
1250 NEXT casillay
1260 REM
1270 REM DECIDE POSICION ALEATORIA DE LA PUERTA Y LA ESTABLECE COMO PUNTO DE ESCAPE
1280 RANDOMIZE TIME: RANDOMIZE RND
1290 pared=INT(RND*4)
1300 IF pared=0 THEN puertay=1:puertax=(INT(RND*11))+2
1310 IF pared=1 THEN puertax=13:puertay=(INT(RND*10))+2
1320 IF pared=2 THEN puertay=12:puertax=(INT(RND*11))+2
1330 IF pared=3 THEN puertax=1:puertay=(INT(RND*10))+2
1340 casilla$(puertax,puertay)="F"
1350 RETURN
1360 REM
1370 REM AVANZAR UNA FASE
1380 LOCATE (x*2)-1, (y*2)-1:PRINT USING"&";borr$
1390 LOCATE (puertax*2)-1,(puertay*2)-1:PRINT USING"&";guerr$
1400 ENV 1,5,3,20:SOUND 1,478,0,0,1
1410 FOR espera=1 TO 500:NEXT espera
1420 ERASE casilla$,mapa$
1430 llave=0
1440 planta=planta+1
1450 CLS#2
1460 GOTO 560
1470 REM
1480 REM ABRE COFRE Y GENERA DINERO AL AZAR
1490 botin=INT(RND*99)+1
1500 LOCATE (destinox*2)-1,(destinoy*2)-1:PRINT USING"&";botin$
1540 casilla$(destinox,destinoy)="$"
1550 GOTO 901
1559 REM
1560 REM COGE EL DINERO
1570 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";borr$
1580 LOCATE (destinox*2)-1,(destinoy*2)-1:PRINT USING"&";guerr$
1581 casilla$(x,y)=".":x=destinox:y=destinoy
1591 FOR espera=1 TO 50:NEXT espera
1920 LOCATE 31,24:PRINT CHR$(15)+CHR$(1);dinero;CHR$(15)+CHR$(3);"+";botin
1930 FOR espera=1 TO 1000:NEXT espera
1940 FOR cuenta=dinero TO (dinero+botin) STEP 2
1950 LOCATE 31,24:PRINT CHR$(15)+CHR$(1);cuenta;CHR$(15)+CHR$(3);"+";botin
1960 SOUND 1,150,1
1970 NEXT cuenta
1980 dinero=dinero+botin:LOCATE 31,24:PRINT CHR$(15)+CHR$(1);dinero;"    ";
1990 GOTO 900
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 23:44, 04 October 19
Quote from: AMSDOS on 22:58, 04 October 19
I got up early to have a look and see, unfortunately while copying code from my mac saved to PDF, problems with the spacing occurred when transferring the text, as a result what I initially had was messed up, fortunately I was able to go back to the PDF and work out the spacing I needed when I pasted it to Notepad, but I was doing it all back to front because I'd made adjustments testing in 464 and then 6128 before realising the copying paste from PDF to Text had messed up the Spacing. I think where the code is to draw the headbanner (640 & 650) I may have put too many spaces in though.


But the only flaw I could see on the 464 was the ends of the Head Banner, which was being drawn on the Map Screen, so line 650 was adjusted using my earlier suggestion and is now working correctly. I have also made adjustments to all the other graphics which use the backspace, cursor down approach and to the ones which have ret$ as well, they appeared to be working fine, though if a larger area for the game should be used, my adjustments should work on a 464 as well.


No creditation is necessary.  8)




10 REM 8 BIT DUNGEONS
20 REM BY JNL
30 REM SEPT 2019
40 REM
50 REM INICIALIZA VARIABLES NUMERICAS
60 MODE 1:BORDER 1
70 WINDOW #2,1,26,1,25
80 planta=1:dinero=0
90 REM
100 REM DEFINE GRAFICOS
110 SYMBOL AFTER 48
120 SYMBOL 48,28,38,102,102,102,100,56,0
130 SYMBOL 49,16,56,24,24,24,24,16,0
140 SYMBOL 50,56,92,8,16,32,68,124,0
150 SYMBOL 51,124,72,16,60,12,8,16,32
160 SYMBOL 52,12,28,44,76,126,12,12,8
170 SYMBOL 53,30,36,112,56,28,12,68,56
180 SYMBOL 54,56,96,104,124,108,108,56,0
190 SYMBOL 55,124,100,8,8,16,16,48,24
200 SYMBOL 56,60,102,100,24,38,102,60,0
210 SYMBOL 57,60,102,102,110,118,38,4,24
220 SYMBOL 76,12,54,112,176,48,34,126,0
230 SYMBOL 86,68,238,102,102,102,111,50,0
240 SYMBOL 72,64,228,110,118,102,103,102,4
250 SYMBOL 80,44,246,102,102,118,236,96,240
251 SYMBOL 235,1,7,14,28,58,60,62,28
252 SYMBOL 236,224,216,220,108,240,120,184,112
260 SYMBOL 237,0,254,252,248,240,248,252,254
270 SYMBOL 238,0,127,63,31,15,31,63,127
280 SYMBOL 239,0,255,255,255,255,255,255,255
290 SYMBOL 240,1,35,119,119,113,116,115,114
300 SYMBOL 241,0,128,192,192,192,128,63,187
310 SYMBOL 242,249,6,119,15,15,15,60,30
320 SYMBOL 243,49,187,59,187,191,222,236,112
330 SYMBOL 244,85,254,255,254,255,254,255,254
340 SYMBOL 245,85,255,255,255,255,255,255,255
350 SYMBOL 246,253,170,127,255,255,255,255,127
360 SYMBOL 247,127,170,255,255,255,255,255,254
370 SYMBOL 248,83,238,217,181,181,109,125,109
380 SYMBOL 249,193,113,153,172,172,182,190,182
390 SYMBOL 250,121,102,118,105,125,109,125,109
400 SYMBOL 251,190,182,190,182,190,182,190,182
410 SYMBOL 252,31,55,59,0,59,59,59,59
420 SYMBOL 253,248,252,204,0,204,252,252,252
430 SYMBOL 254,0,0,6,73,249,6,0,0
440 REM
450 REM DEFINE VARIABLES DE LOS SPRITES
460 ret$=STRING$(2,8)+CHR$(10)
470 borr$="  "+ret$+"  "
480 guerr$=CHR$(15)+CHR$(1)+CHR$(240)+CHR$(241)+STRING$(2,8)+CHR$(10)+CHR$(242)+CHR$(243)
490 muro$=CHR$(15)+CHR$(1)+CHR$(244)+CHR$(245)+STRING$(2,8)+CHR$(10)+CHR$(246)+CHR$(247)
500 puerta$=CHR$(15)+CHR$(2)+CHR$(248)+CHR$(249)+ret$+CHR$(250)+CHR$(251)
510 cofre$=CHR$(15)+CHR$(1)+"  "+ret$+CHR$(252)+CHR$(253)
520 llave$=CHR$(15)+CHR$(2)+"  "+ret$+" "+CHR$(254)
530 cintai$=CHR$(15)+CHR$(3)+CHR$(238)+CHR$(239)
540 cintad$=CHR$(15)+CHR$(3)+CHR$(239)+CHR$(237)
541 botin$=CHR$(15)+CHR$(1)+"  "+ret$+CHR$(235)+CHR$(236)
550 REM
560 REM DIBUJA PANTALLA DE JUEGO
570 GOSUB 1070
580 FOR y=1 TO 12
590 FOR x=1 TO 13
600 IF casilla$(x,y)="*" THEN LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";muro$
610 IF casilla$(x,y)="F" THEN LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";puerta$
620 NEXT x
630 NEXT y
640 LOCATE 30,1:PAPER 3:PEN 0:PRINT "        "
650 LOCATE 29,2:PAPER 0:PEN 3:PRINT USING"&";cintai$+"      "+cintad$
660 LOCATE 31,1:PAPER 3:PEN 0:PRINT planta
670 LOCATE 28,4:PAPER 0:PRINT USING"&";guerr$
680 LOCATE 31,4:PRINT"LV 06"
690 LOCATE 31,5:PRINT"HP 128/580"
691 LOCATE 28,23:PRINT USING"&";botin$;:PRINT"x";dinero
700 REM
710 REM DECIDE POSICION ALEATORIA DE JUGADOR Y LLAVE. LOS DIBUJA
720 x=INT(RND*11)+2:y=INT(RND*10)+2
730 casilla$(x,y)="J"
740 LOCATE (x*2)-1, (y*2)-1:PEN 1:PRINT USING"&";guerr$
750 llavex=INT(RND*11)+2:llavey=INT(RND*10)+2
760 IF casilla$(llavex,llavey)<>"." THEN 750
770 casilla$(llavex,llavey)="K"
771 LOCATE (llavex*2)-1, (llavey*2)-1:PRINT USING"&";llave$
772 REM
773 REM DECIDE POSICION ALEATORIA DE COFRE Y LO DIBUJA
774 cofrex=INT(RND*11)+2:cofrey=INT(RND*10)+2
775 IF casilla$(cofrex,cofrey)<>"." THEN 774
776 casilla$(cofrex,cofrey)="C"
777 LOCATE (cofrex*2)-1, (cofrey*2)-1:PRINT USING"&";cofre$
808 REM
809 REM CALCULA OBSTACULOS AL AZAR Y LOS DIBUJA
810 FOR casillay=3 TO 10
820 FOR casillax=3 TO 11
830 IF casilla$(casillax,casillay)<>"." THEN GOTO 860
840 RANDOMIZE RND:obs=INT(RND*4):IF obs<>1 THEN GOTO 860
850 LOCATE (casillax*2)-1,(casillay*2)-1:PRINT USING"&";muro$:casilla$(casillax,casillay)="*"
860 NEXT casillax
870 NEXT casillay
880 REM
890 REM TURNO DEL JUGADOR
900 casilla$(x,y)="J":WHILE INKEY$<>"":WEND
901 a$=INKEY$:IF a$="" THEN 901
910 IF a$=CHR$(240) THEN destinox=x:destinoy=y-1:GOTO 970
920 IF a$=CHR$(241) THEN destinox=x:destinoy=y+1:GOTO 970
930 IF a$=CHR$(242) THEN destinox=x-1:destinoy=y:GOTO 970
940 IF a$=CHR$(243) THEN destinox=x+1:destinoy=y:GOTO 970
950 GOTO 901
960 REM
970 REM MOVER JUGADOR
980 IF casilla$(destinox,destinoy)="*" THEN 901
990 IF casilla$(destinox,destinoy)="F" AND llave=1 THEN 1370
1000 IF casilla$(destinox,destinoy)="F" AND llave=0 THEN 901
1001 IF casilla$(destinox,destinoy)="K" THEN llave=1:SOUND 1,150,10:SOUND 1,50,10
1002 IF casilla$(destinox,destinoy)="C" THEN 1470
1003 IF casilla$(destinox,destinoy)="$" THEN 1560
1020 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";borr$
1030 x=destinox:y=destinoy
1040 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";guerr$:SOUND 1,4000,1:SOUND 1,4000,1
1050 GOTO 900
1060 REM
1070 REM DEFINE CUADRICULA DEL MAPA
1080 DIM casilla$(14,13):DIM mapa$(12)
1090 mapa$(1)="*************"
1100 mapa$(2)="*...........*"
1110 mapa$(3)="*...........*"
1120 mapa$(4)="*...........*"
1130 mapa$(5)="*...........*"
1140 mapa$(6)="*...........*"
1150 mapa$(7)="*...........*"
1160 mapa$(="*...........*"
1170 mapa$(9)="*...........*"
1180 mapa$(10)="*...........*"
1190 mapa$(11)="*...........*"
1200 mapa$(12)="*************"
1210 FOR casillay=1 TO 12
1220 FOR casillax=1 TO 13
1230 casilla$(casillax,casillay)=MID$(mapa$(casillay),casillax,1)
1240 NEXT casillax
1250 NEXT casillay
1260 REM
1270 REM DECIDE POSICION ALEATORIA DE LA PUERTA Y LA ESTABLECE COMO PUNTO DE ESCAPE
1280 RANDOMIZE TIME: RANDOMIZE RND
1290 pared=INT(RND*4)
1300 IF pared=0 THEN puertay=1:puertax=(INT(RND*11))+2
1310 IF pared=1 THEN puertax=13:puertay=(INT(RND*10))+2
1320 IF pared=2 THEN puertay=12:puertax=(INT(RND*11))+2
1330 IF pared=3 THEN puertax=1:puertay=(INT(RND*10))+2
1340 casilla$(puertax,puertay)="F"
1350 RETURN
1360 REM
1370 REM AVANZAR UNA FASE
1380 LOCATE (x*2)-1, (y*2)-1:PRINT USING"&";borr$
1390 LOCATE (puertax*2)-1,(puertay*2)-1:PRINT USING"&";guerr$
1400 ENV 1,5,3,20:SOUND 1,478,0,0,1
1410 FOR espera=1 TO 500:NEXT espera
1420 ERASE casilla$,mapa$
1430 llave=0
1440 planta=planta+1
1450 CLS#2
1460 GOTO 560
1470 REM
1480 REM ABRE COFRE Y GENERA DINERO AL AZAR
1490 botin=INT(RND*99)+1
1500 LOCATE (destinox*2)-1,(destinoy*2)-1:PRINT USING"&";botin$
1540 casilla$(destinox,destinoy)="$"
1550 GOTO 901
1559 REM
1560 REM COGE EL DINERO
1570 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";borr$
1580 LOCATE (destinox*2)-1,(destinoy*2)-1:PRINT USING"&";guerr$
1581 casilla$(x,y)=".":x=destinox:y=destinoy
1591 FOR espera=1 TO 50:NEXT espera
1920 LOCATE 31,24:PRINT CHR$(15)+CHR$(1);dinero;CHR$(15)+CHR$(3);"+";botin
1930 FOR espera=1 TO 1000:NEXT espera
1940 FOR cuenta=dinero TO (dinero+botin) STEP 2
1950 LOCATE 31,24:PRINT CHR$(15)+CHR$(1);cuenta;CHR$(15)+CHR$(3);"+";botin
1960 SOUND 1,150,1
1970 NEXT cuenta
1980 dinero=dinero+botin:LOCATE 31,24:PRINT CHR$(15)+CHR$(1);dinero;"    ";
1990 GOTO 900

Awesome! I´m going to insert a second code in the first post for 464. And, by the way, I´m now updating the post with some new cool features :)
Title: Re: My roguelike in BASIC
Post by: AMSDOS on 01:28, 05 October 19
Just so there's no confusion, all the adjustments I made to the game, it'll continue to work with BASIC 1.1, though understand having the code alongside one another is handy for comparision. :)
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 01:39, 05 October 19
Quote from: AMSDOS on 01:28, 05 October 19
Just so there's no confusion, all the adjustments I made to the game, it'll continue to work with BASIC 1.1, though understand having the code alongside one another is handy for comparision. :)
Oh, great then. I thought the differences were bigger. So, feel free to retouch the code in any future update (that´s what it is published for :P), or in the final release.
Only downside is, when the game is finished, there will be a ton of lines to review.
Title: Re: My roguelike in BASIC
Post by: AMSDOS on 09:16, 05 October 19
Quote from: PAQUITO on 01:39, 05 October 19
Oh, great then. I thought the differences were bigger. So, feel free to retouch the code in any future update (that´s what it is published for :P ), or in the final release.


Have updated it now so it reflects the current version.  :D




10 REM 8 BIT DUNGEONS
20 REM BY JNL
30 REM SEPT 2019
40 REM
50 REM INICIALIZA VARIABLES NUMERICAS
60 MODE 1:BORDER 1
70 WINDOW #2,1,26,1,25
80 planta=1:dinero=0
90 REM
100 REM DEFINE GRAFICOS
110 SYMBOL AFTER 48
120 SYMBOL 48,28,38,102,102,102,100,56,0
130 SYMBOL 49,16,56,24,24,24,24,16,0
140 SYMBOL 50,56,92,8,16,32,68,124,0
150 SYMBOL 51,124,72,16,60,12,8,16,32
160 SYMBOL 52,12,28,44,76,126,12,12,8
170 SYMBOL 53,30,36,112,56,28,12,68,56
180 SYMBOL 54,56,96,104,124,108,108,56,0
190 SYMBOL 55,124,100,8,8,16,16,48,24
200 SYMBOL 56,60,102,100,24,38,102,60,0
201 SYMBOL 65,2,54,78,86,38,86,142,0
210 SYMBOL 57,60,102,102,110,118,38,4,24
220 SYMBOL 76,12,54,112,176,48,34,126,0
221 SYMBOL 82,54,91,49,50,60,54,243,0
222 SYMBOL 83,58,68,200,124,38,98,188,0
223 SYMBOL 77,74,254,106,106,106,107,74,0
224 SYMBOL 79,60,70,214,238,198,196,120,0
225 SYMBOL 86,68,238,118,102,102,54,28,0
230 SYMBOL 85,68,238,102,102,102,111,50,0
231 SYMBOL 69,222,100,104,124,100,64,254,0
232 SYMBOL 84,122,174,104,104,104,106,60,0
233 SYMBOL 67,58,86,208,208,208,82,60,0
240 SYMBOL 72,64,228,110,118,102,103,102,4
250 SYMBOL 80,44,246,102,102,118,236,96,240
251 SYMBOL 235,1,7,14,28,58,60,62,28
252 SYMBOL 236,224,216,220,108,240,120,184,112
253 SYMBOL 231,0,0,0,0,0,0,195,239
254 SYMBOL 232,0,0,0,0,48,240,224,192
255 SYMBOL 233,223,239,223,239,223,227,192,0
256 SYMBOL 234,255,255,232,232,208,160,0,0
260 SYMBOL 237,0,254,252,248,240,248,252,254
270 SYMBOL 238,0,127,63,31,15,31,63,127
280 SYMBOL 239,0,255,255,255,255,255,255,255
290 SYMBOL 240,1,35,119,119,113,116,115,114
300 SYMBOL 241,0,128,192,192,192,128,63,187
310 SYMBOL 242,249,6,119,15,15,15,60,30
320 SYMBOL 243,49,187,59,187,191,222,236,112
330 SYMBOL 244,85,254,255,254,255,254,255,254
340 SYMBOL 245,85,255,255,255,255,255,255,255
350 SYMBOL 246,253,170,127,255,255,255,255,127
360 SYMBOL 247,127,170,255,255,255,255,255,254
370 SYMBOL 248,83,238,217,181,181,109,125,109
380 SYMBOL 249,193,113,153,172,172,182,190,182
390 SYMBOL 250,121,102,118,105,125,109,125,109
400 SYMBOL 251,190,182,190,182,190,182,190,182
410 SYMBOL 252,31,55,59,0,59,59,59,59
420 SYMBOL 253,248,252,204,0,204,252,252,252
430 SYMBOL 254,0,0,6,73,249,6,0,0
440 REM
450 REM DEFINE VARIABLES DE LOS SPRITES
460 ret$=STRING$(2,8)+CHR$(10)
470 borr$="  "+ret$+"  "
480 guerr$=CHR$(15)+CHR$(1)+CHR$(240)+CHR$(241)+STRING$(2,8)+CHR$(10)+CHR$(242)+CHR$(243)
490 muro$=CHR$(15)+CHR$(1)+CHR$(244)+CHR$(245)+STRING$(2,8)+CHR$(10)+CHR$(246)+CHR$(247)
500 puerta$=CHR$(15)+CHR$(2)+CHR$(248)+CHR$(249)+ret$+CHR$(250)+CHR$(251)
510 cofre$=CHR$(15)+CHR$(1)+"  "+ret$+CHR$(252)+CHR$(253)
520 llave$=CHR$(15)+CHR$(2)+"  "+ret$+" "+CHR$(254)
530 cintai$=CHR$(15)+CHR$(3)+CHR$(238)+CHR$(239)
540 cintad$=CHR$(15)+CHR$(3)+CHR$(239)+CHR$(237)
541 botin$=CHR$(15)+CHR$(1)+"  "+ret$+CHR$(235)+CHR$(236)
542 mano$=CHR$(15)+CHR$(2)+CHR$(231)+CHR$(232)+ret$+CHR$(233)+CHR$(234)
550 REM
560 REM DIBUJA PANTALLA DE JUEGO
570 GOSUB 1070
580 FOR y=1 TO 12
590 FOR x=1 TO 13
600 IF casilla$(x,y)="*" THEN PAPER 0:LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";muro$
610 IF casilla$(x,y)="F" THEN PAPER 0:LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";puerta$
620 NEXT x
630 NEXT y
640 LOCATE 30,1:PAPER 3:PEN 0:PRINT "        "
650 LOCATE 29,2:PAPER 0:PEN 3:PRINT USING"&";cintai$+"      "+cintad$
660 LOCATE 31,1:PAPER 3:PEN 0:PRINT planta
670 LOCATE 28,4:PAPER 0:PRINT USING"&";guerr$
680 LOCATE 31,4:PRINT"LV 06"
690 LOCATE 31,5:PRINT"HP 128/580"
691 LOCATE 28,23:PRINT USING"&";botin$;:PRINT "x";dinero
700 REM
710 REM DECIDE POSICION ALEATORIA DE JUGADOR Y LLAVE. LOS DIBUJA
720 x=INT(RND*11)+2:y=INT(RND*10)+2
730 casilla$(x,y)="J"
740 LOCATE (x*2)-1, (y*2)-1:PEN 1:PRINT USING"&";guerr$
750 llavex=INT(RND*11)+2:llavey=INT(RND*10)+2
760 IF casilla$(llavex,llavey)<>"." THEN 750
770 casilla$(llavex,llavey)="K"
771 LOCATE (llavex*2)-1, (llavey*2)-1:PRINT USING"&";llave$
772 REM
773 REM DECIDE POSICION ALEATORIA DE COFRE Y LO DIBUJA
774 cofrex=INT(RND*11)+2:cofrey=INT(RND*10)+2
775 IF casilla$(cofrex,cofrey)<>"." THEN 774
776 casilla$(cofrex,cofrey)="C"
777 LOCATE (cofrex*2)-1, (cofrey*2)-1:PRINT USING"&";cofre$
808 REM
809 REM CALCULA OBSTACULOS AL AZAR Y LOS DIBUJA
810 FOR casillay=3 TO 10
820 FOR casillax=3 TO 11
830 IF casilla$(casillax,casillay)<>"." THEN GOTO 860
840 RANDOMIZE RND:obs=INT(RND*4):IF obs<>1 THEN GOTO 860
850 LOCATE (casillax*2)-1,(casillay*2)-1:PRINT USING"&";muro$:casilla$(casillax,casillay)="*"
860 NEXT casillax
870 NEXT casillay
880 REM
890 REM TURNO DEL JUGADOR
891 GOSUB 2000
900 casilla$(x,y)="J":WHILE INKEY$<>"":WEND
901 a$=INKEY$:IF a$="" THEN 901
910 IF a$=CHR$(240) THEN destinox=x:destinoy=y-1:GOTO 970
920 IF a$=CHR$(241) THEN destinox=x:destinoy=y+1:GOTO 970
930 IF a$=CHR$(242) THEN destinox=x-1:destinoy=y:GOTO 970
940 IF a$=CHR$(243) THEN destinox=x+1:destinoy=y:GOTO 970
950 GOTO 901
960 REM
970 REM MOVER JUGADOR
980 IF casilla$(destinox,destinoy)="*" THEN 901
990 IF casilla$(destinox,destinoy)="F" AND llave=1 THEN 1370
1000 IF casilla$(destinox,destinoy)="F" AND llave=0 THEN 901
1001 IF casilla$(destinox,destinoy)="K" THEN llave=1:SOUND 1,150,10:SOUND 1,50,10
1002 IF casilla$(destinox,destinoy)="C" THEN 1470
1003 IF casilla$(destinox,destinoy)="$" THEN 1560
1020 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";borr$
1030 x=destinox:y=destinoy
1040 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";guerr$:SOUND 1,4000,1:SOUND 1,4000,1
1041 pasos=pasos-1:IF pasos=0 THEN 2000
1050 GOTO 900
1060 REM
1070 REM DEFINE CUADRICULA DEL MAPA
1080 DIM casilla$(14,13):DIM mapa$(12)
1090 mapa$(1)="*************"
1100 mapa$(2)="*...........*"
1110 mapa$(3)="*...........*"
1120 mapa$(4)="*...........*"
1130 mapa$(5)="*...........*"
1140 mapa$(6)="*...........*"
1150 mapa$(7)="*...........*"
1160 mapa$(8)="*...........*"
1170 mapa$(9)="*...........*"
1180 mapa$(10)="*...........*"
1190 mapa$(11)="*...........*"
1200 mapa$(12)="*************"
1210 FOR casillay=1 TO 12
1220 FOR casillax=1 TO 13
1230 casilla$(casillax,casillay)=MID$(mapa$(casillay),casillax,1)
1240 NEXT casillax
1250 NEXT casillay
1260 REM
1270 REM DECIDE POSICION ALEATORIA DE LA PUERTA Y LA ESTABLECE COMO PUNTO DE ESCAPE
1280 RANDOMIZE TIME: RANDOMIZE RND
1290 pared=INT(RND*4)
1300 IF pared=0 THEN puertay=1:puertax=(INT(RND*11))+2
1310 IF pared=1 THEN puertax=13:puertay=(INT(RND*10))+2
1320 IF pared=2 THEN puertay=12:puertax=(INT(RND*11))+2
1330 IF pared=3 THEN puertax=1:puertay=(INT(RND*10))+2
1340 casilla$(puertax,puertay)="F"
1350 RETURN
1360 REM
1370 REM AVANZAR UNA FASE
1380 LOCATE (x*2)-1, (y*2)-1:PRINT USING"&";borr$
1390 LOCATE (puertax*2)-1,(puertay*2)-1:PRINT USING"&";guerr$
1400 ENV 1,5,3,20:SOUND 1,478,0,0,1
1410 FOR espera=1 TO 500:NEXT espera
1420 ERASE casilla$,mapa$
1430 llave=0
1440 planta=planta+1
1450 CLS#2
1460 GOTO 560
1470 REM
1480 REM ABRE COFRE Y GENERA DINERO AL AZAR
1490 botin=INT(RND*99)+1
1500 LOCATE (destinox*2)-1,(destinoy*2)-1:PRINT USING"&";botin$
1540 casilla$(destinox,destinoy)="$"
1550 GOTO 901
1559 REM
1560 REM COGE EL DINERO
1570 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";borr$
1580 LOCATE (destinox*2)-1,(destinoy*2)-1:PRINT USING"&";guerr$
1581 casilla$(x,y)=".":x=destinox:y=destinoy
1591 FOR espera=1 TO 50:NEXT espera
1920 LOCATE 31,24:PRINT CHR$(15)+CHR$(1);dinero;CHR$(15)+CHR$(3);"+";botin
1930 FOR espera=1 TO 1000:NEXT espera
1940 FOR cuenta=dinero TO (dinero+botin) STEP 2
1950 LOCATE 31,24:PRINT CHR$(15)+CHR$(1);cuenta;CHR$(15)+CHR$(3);"+";botin
1960 SOUND 1,150,1
1970 NEXT cuenta
1980 dinero=dinero+botin:LOCATE 31,24:PRINT CHR$(15)+CHR$(1);dinero;"     ";
1990 GOTO 1041
2000 REM
2001 REM MENU
2002 opcion$(1)="PASAR"
2003 opcion$(2)="MOVER"
2004 opcion$(3)="ATACAR"
2005 opcion$(4)="USAR"
2006 FOR opcion=1 TO 4:PAPER 0:PEN 1:LOCATE 32,opcion+7:PRINT opcion$(opcion):NEXT opcion
2060 LOCATE 30,7:PRINT USING"&";mano$
2070 opcion=1
2071 LOCATE 30,opcion+6:PRINT USING"&";mano$
2072 LOCATE 32,opcion+7:PAPER 2:PEN 0:PRINT opcion$(opcion)
2080 a$=INKEY$:IF a$="" THEN 2080
2090 IF a$=CHR$(240) THEN 2140
2100 IF a$=CHR$(241) THEN 2180
2101 IF (a$=" " AND opcion=2) THEN 2250
2130 GOTO 2080
2140 IF opcion=1 THEN 2080
2150 PAPER 0:LOCATE 30,opcion+6:PRINT USING"&";borr$
2160 PEN 1:PAPER 0:LOCATE 32,opcion+7:PRINT opcion$(opcion)
2170 opcion=opcion-1:GOTO 2071
2180 IF opcion=4 THEN 2080
2190 PAPER 0:LOCATE 30,opcion+6:PRINT USING"&";borr$
2200 PEN 1:PAPER 0:LOCATE 32,opcion+7:PRINT opcion$(opcion)
2210 opcion=opcion+1:GOTO 2071
2250 WINDOW#3,28,40,7,11:PAPER 1:CLS#3
2260 pasos=5:PAPER 0:GOTO 901



The differences between Locomotive BASIC 1.0 and 1.1 get trickier to code when more of the 1.1 extra commands are used, but this isn't the case here since you are using an array instead of COPYCHR$(#0) for example to check what's in the array.
CLEAR INPUT is the only extra command from 1.1 to clear keyboard buffer, though @SRS (http://www.cpcwiki.eu/forum/index.php?action=profile;u=805) provided you with a workable 1.0 solution, there is the firmware as well in CALL &BB03 which Resets the Keyboard Buffer, though I try not to use because it does a few other things as well as Clearing the Keyboard Buffer when initiated.


The main difference now with the game in 1.0 and 1.1 is the SOUND. SOUND is a tough one because of the way the volume operates. In 1.0, the volume is 0 to 7 with 7 being the loudest, though 8 to 15 can be used in 1.0, but what happens is 8 is quiet again going up to 15. So 12 seems to be the best volume setting for all computers. I'm not a sound expert though, though from time to time I've used the Sound Experiment Programme For Amstrad CPC 464 (https://www.cpc-power.com/index.php?page=detail&num=10484) to create Sound FXs.


Quote
Only downside is, when the game is finished, there will be a ton of lines to review.


I'm not going to pretend I understand the game coding fully as I have only isolated the areas where there maybe visual problems on 464, but the adjustments are fully compatable with 1.1, when I was testing this earlier here (http://www.cpcwiki.eu/forum/programming/multicoloured-graphics-in-basic-discuss/msg175500/#msg175500). If it's no trouble saving the game to a DSK image, it would save some time Copying/Pasting & Correcting any mistakes.


One thing I noticed was when 1000 points are accumulated, a little problem occurs when the added points moves down a line leaving a line with added points in red on display as shown in this screenshot.
Title: Re: My roguelike in BASIC
Post by: XeNoMoRPH on 12:13, 05 October 19
https://vimeo.com/364471958
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 14:13, 05 October 19
Quote from: AMSDOS on 09:16, 05 October 19

Have updated it now so it reflects the current version.  :D




10 REM 8 BIT DUNGEONS
20 REM BY JNL
30 REM SEPT 2019
40 REM
50 REM INICIALIZA VARIABLES NUMERICAS
60 MODE 1:BORDER 1
70 WINDOW #2,1,26,1,25
80 planta=1:dinero=0
90 REM
100 REM DEFINE GRAFICOS
110 SYMBOL AFTER 48
120 SYMBOL 48,28,38,102,102,102,100,56,0
130 SYMBOL 49,16,56,24,24,24,24,16,0
140 SYMBOL 50,56,92,8,16,32,68,124,0
150 SYMBOL 51,124,72,16,60,12,8,16,32
160 SYMBOL 52,12,28,44,76,126,12,12,8
170 SYMBOL 53,30,36,112,56,28,12,68,56
180 SYMBOL 54,56,96,104,124,108,108,56,0
190 SYMBOL 55,124,100,8,8,16,16,48,24
200 SYMBOL 56,60,102,100,24,38,102,60,0
201 SYMBOL 65,2,54,78,86,38,86,142,0
210 SYMBOL 57,60,102,102,110,118,38,4,24
220 SYMBOL 76,12,54,112,176,48,34,126,0
221 SYMBOL 82,54,91,49,50,60,54,243,0
222 SYMBOL 83,58,68,200,124,38,98,188,0
223 SYMBOL 77,74,254,106,106,106,107,74,0
224 SYMBOL 79,60,70,214,238,198,196,120,0
225 SYMBOL 86,68,238,118,102,102,54,28,0
230 SYMBOL 85,68,238,102,102,102,111,50,0
231 SYMBOL 69,222,100,104,124,100,64,254,0
232 SYMBOL 84,122,174,104,104,104,106,60,0
233 SYMBOL 67,58,86,208,208,208,82,60,0
240 SYMBOL 72,64,228,110,118,102,103,102,4
250 SYMBOL 80,44,246,102,102,118,236,96,240
251 SYMBOL 235,1,7,14,28,58,60,62,28
252 SYMBOL 236,224,216,220,108,240,120,184,112
253 SYMBOL 231,0,0,0,0,0,0,195,239
254 SYMBOL 232,0,0,0,0,48,240,224,192
255 SYMBOL 233,223,239,223,239,223,227,192,0
256 SYMBOL 234,255,255,232,232,208,160,0,0
260 SYMBOL 237,0,254,252,248,240,248,252,254
270 SYMBOL 238,0,127,63,31,15,31,63,127
280 SYMBOL 239,0,255,255,255,255,255,255,255
290 SYMBOL 240,1,35,119,119,113,116,115,114
300 SYMBOL 241,0,128,192,192,192,128,63,187
310 SYMBOL 242,249,6,119,15,15,15,60,30
320 SYMBOL 243,49,187,59,187,191,222,236,112
330 SYMBOL 244,85,254,255,254,255,254,255,254
340 SYMBOL 245,85,255,255,255,255,255,255,255
350 SYMBOL 246,253,170,127,255,255,255,255,127
360 SYMBOL 247,127,170,255,255,255,255,255,254
370 SYMBOL 248,83,238,217,181,181,109,125,109
380 SYMBOL 249,193,113,153,172,172,182,190,182
390 SYMBOL 250,121,102,118,105,125,109,125,109
400 SYMBOL 251,190,182,190,182,190,182,190,182
410 SYMBOL 252,31,55,59,0,59,59,59,59
420 SYMBOL 253,248,252,204,0,204,252,252,252
430 SYMBOL 254,0,0,6,73,249,6,0,0
440 REM
450 REM DEFINE VARIABLES DE LOS SPRITES
460 ret$=STRING$(2,8)+CHR$(10)
470 borr$="  "+ret$+"  "
480 guerr$=CHR$(15)+CHR$(1)+CHR$(240)+CHR$(241)+STRING$(2,8)+CHR$(10)+CHR$(242)+CHR$(243)
490 muro$=CHR$(15)+CHR$(1)+CHR$(244)+CHR$(245)+STRING$(2,8)+CHR$(10)+CHR$(246)+CHR$(247)
500 puerta$=CHR$(15)+CHR$(2)+CHR$(248)+CHR$(249)+ret$+CHR$(250)+CHR$(251)
510 cofre$=CHR$(15)+CHR$(1)+"  "+ret$+CHR$(252)+CHR$(253)
520 llave$=CHR$(15)+CHR$(2)+"  "+ret$+" "+CHR$(254)
530 cintai$=CHR$(15)+CHR$(3)+CHR$(238)+CHR$(239)
540 cintad$=CHR$(15)+CHR$(3)+CHR$(239)+CHR$(237)
541 botin$=CHR$(15)+CHR$(1)+"  "+ret$+CHR$(235)+CHR$(236)
542 mano$=CHR$(15)+CHR$(2)+CHR$(231)+CHR$(232)+ret$+CHR$(233)+CHR$(234)
550 REM
560 REM DIBUJA PANTALLA DE JUEGO
570 GOSUB 1070
580 FOR y=1 TO 12
590 FOR x=1 TO 13
600 IF casilla$(x,y)="*" THEN PAPER 0:LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";muro$
610 IF casilla$(x,y)="F" THEN PAPER 0:LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";puerta$
620 NEXT x
630 NEXT y
640 LOCATE 30,1:PAPER 3:PEN 0:PRINT "        "
650 LOCATE 29,2:PAPER 0:PEN 3:PRINT USING"&";cintai$+"      "+cintad$
660 LOCATE 31,1:PAPER 3:PEN 0:PRINT planta
670 LOCATE 28,4:PAPER 0:PRINT USING"&";guerr$
680 LOCATE 31,4:PRINT"LV 06"
690 LOCATE 31,5:PRINT"HP 128/580"
691 LOCATE 28,23:PRINT USING"&";botin$;:PRINT "x";dinero
700 REM
710 REM DECIDE POSICION ALEATORIA DE JUGADOR Y LLAVE. LOS DIBUJA
720 x=INT(RND*11)+2:y=INT(RND*10)+2
730 casilla$(x,y)="J"
740 LOCATE (x*2)-1, (y*2)-1:PEN 1:PRINT USING"&";guerr$
750 llavex=INT(RND*11)+2:llavey=INT(RND*10)+2
760 IF casilla$(llavex,llavey)<>"." THEN 750
770 casilla$(llavex,llavey)="K"
771 LOCATE (llavex*2)-1, (llavey*2)-1:PRINT USING"&";llave$
772 REM
773 REM DECIDE POSICION ALEATORIA DE COFRE Y LO DIBUJA
774 cofrex=INT(RND*11)+2:cofrey=INT(RND*10)+2
775 IF casilla$(cofrex,cofrey)<>"." THEN 774
776 casilla$(cofrex,cofrey)="C"
777 LOCATE (cofrex*2)-1, (cofrey*2)-1:PRINT USING"&";cofre$
808 REM
809 REM CALCULA OBSTACULOS AL AZAR Y LOS DIBUJA
810 FOR casillay=3 TO 10
820 FOR casillax=3 TO 11
830 IF casilla$(casillax,casillay)<>"." THEN GOTO 860
840 RANDOMIZE RND:obs=INT(RND*4):IF obs<>1 THEN GOTO 860
850 LOCATE (casillax*2)-1,(casillay*2)-1:PRINT USING"&";muro$:casilla$(casillax,casillay)="*"
860 NEXT casillax
870 NEXT casillay
880 REM
890 REM TURNO DEL JUGADOR
891 GOSUB 2000
900 casilla$(x,y)="J":WHILE INKEY$<>"":WEND
901 a$=INKEY$:IF a$="" THEN 901
910 IF a$=CHR$(240) THEN destinox=x:destinoy=y-1:GOTO 970
920 IF a$=CHR$(241) THEN destinox=x:destinoy=y+1:GOTO 970
930 IF a$=CHR$(242) THEN destinox=x-1:destinoy=y:GOTO 970
940 IF a$=CHR$(243) THEN destinox=x+1:destinoy=y:GOTO 970
950 GOTO 901
960 REM
970 REM MOVER JUGADOR
980 IF casilla$(destinox,destinoy)="*" THEN 901
990 IF casilla$(destinox,destinoy)="F" AND llave=1 THEN 1370
1000 IF casilla$(destinox,destinoy)="F" AND llave=0 THEN 901
1001 IF casilla$(destinox,destinoy)="K" THEN llave=1:SOUND 1,150,10:SOUND 1,50,10
1002 IF casilla$(destinox,destinoy)="C" THEN 1470
1003 IF casilla$(destinox,destinoy)="$" THEN 1560
1020 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";borr$
1030 x=destinox:y=destinoy
1040 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";guerr$:SOUND 1,4000,1:SOUND 1,4000,1
1041 pasos=pasos-1:IF pasos=0 THEN 2000
1050 GOTO 900
1060 REM
1070 REM DEFINE CUADRICULA DEL MAPA
1080 DIM casilla$(14,13):DIM mapa$(12)
1090 mapa$(1)="*************"
1100 mapa$(2)="*...........*"
1110 mapa$(3)="*...........*"
1120 mapa$(4)="*...........*"
1130 mapa$(5)="*...........*"
1140 mapa$(6)="*...........*"
1150 mapa$(7)="*...........*"
1160 mapa$(="*...........*"
1170 mapa$(9)="*...........*"
1180 mapa$(10)="*...........*"
1190 mapa$(11)="*...........*"
1200 mapa$(12)="*************"
1210 FOR casillay=1 TO 12
1220 FOR casillax=1 TO 13
1230 casilla$(casillax,casillay)=MID$(mapa$(casillay),casillax,1)
1240 NEXT casillax
1250 NEXT casillay
1260 REM
1270 REM DECIDE POSICION ALEATORIA DE LA PUERTA Y LA ESTABLECE COMO PUNTO DE ESCAPE
1280 RANDOMIZE TIME: RANDOMIZE RND
1290 pared=INT(RND*4)
1300 IF pared=0 THEN puertay=1:puertax=(INT(RND*11))+2
1310 IF pared=1 THEN puertax=13:puertay=(INT(RND*10))+2
1320 IF pared=2 THEN puertay=12:puertax=(INT(RND*11))+2
1330 IF pared=3 THEN puertax=1:puertay=(INT(RND*10))+2
1340 casilla$(puertax,puertay)="F"
1350 RETURN
1360 REM
1370 REM AVANZAR UNA FASE
1380 LOCATE (x*2)-1, (y*2)-1:PRINT USING"&";borr$
1390 LOCATE (puertax*2)-1,(puertay*2)-1:PRINT USING"&";guerr$
1400 ENV 1,5,3,20:SOUND 1,478,0,0,1
1410 FOR espera=1 TO 500:NEXT espera
1420 ERASE casilla$,mapa$
1430 llave=0
1440 planta=planta+1
1450 CLS#2
1460 GOTO 560
1470 REM
1480 REM ABRE COFRE Y GENERA DINERO AL AZAR
1490 botin=INT(RND*99)+1
1500 LOCATE (destinox*2)-1,(destinoy*2)-1:PRINT USING"&";botin$
1540 casilla$(destinox,destinoy)="$"
1550 GOTO 901
1559 REM
1560 REM COGE EL DINERO
1570 LOCATE (x*2)-1,(y*2)-1:PRINT USING"&";borr$
1580 LOCATE (destinox*2)-1,(destinoy*2)-1:PRINT USING"&";guerr$
1581 casilla$(x,y)=".":x=destinox:y=destinoy
1591 FOR espera=1 TO 50:NEXT espera
1920 LOCATE 31,24:PRINT CHR$(15)+CHR$(1);dinero;CHR$(15)+CHR$(3);"+";botin
1930 FOR espera=1 TO 1000:NEXT espera
1940 FOR cuenta=dinero TO (dinero+botin) STEP 2
1950 LOCATE 31,24:PRINT CHR$(15)+CHR$(1);cuenta;CHR$(15)+CHR$(3);"+";botin
1960 SOUND 1,150,1
1970 NEXT cuenta
1980 dinero=dinero+botin:LOCATE 31,24:PRINT CHR$(15)+CHR$(1);dinero;"     ";
1990 GOTO 1041
2000 REM
2001 REM MENU
2002 opcion$(1)="PASAR"
2003 opcion$(2)="MOVER"
2004 opcion$(3)="ATACAR"
2005 opcion$(4)="USAR"
2006 FOR opcion=1 TO 4:PAPER 0:PEN 1:LOCATE 32,opcion+7:PRINT opcion$(opcion):NEXT opcion
2060 LOCATE 30,7:PRINT USING"&";mano$
2070 opcion=1
2071 LOCATE 30,opcion+6:PRINT USING"&";mano$
2072 LOCATE 32,opcion+7:PAPER 2:PEN 0:PRINT opcion$(opcion)
2080 a$=INKEY$:IF a$="" THEN 2080
2090 IF a$=CHR$(240) THEN 2140
2100 IF a$=CHR$(241) THEN 2180
2101 IF (a$=" " AND opcion=2) THEN 2250
2130 GOTO 2080
2140 IF opcion=1 THEN 2080
2150 PAPER 0:LOCATE 30,opcion+6:PRINT USING"&";borr$
2160 PEN 1:PAPER 0:LOCATE 32,opcion+7:PRINT opcion$(opcion)
2170 opcion=opcion-1:GOTO 2071
2180 IF opcion=4 THEN 2080
2190 PAPER 0:LOCATE 30,opcion+6:PRINT USING"&";borr$
2200 PEN 1:PAPER 0:LOCATE 32,opcion+7:PRINT opcion$(opcion)
2210 opcion=opcion+1:GOTO 2071
2250 WINDOW#3,28,40,7,11:PAPER 1:CLS#3
2260 pasos=5:PAPER 0:GOTO 901



The differences between Locomotive BASIC 1.0 and 1.1 get trickier to code when more of the 1.1 extra commands are used, but this isn't the case here since you are using an array instead of COPYCHR$(#0) for example to check what's in the array.
CLEAR INPUT is the only extra command from 1.1 to clear keyboard buffer, though @SRS (http://www.cpcwiki.eu/forum/index.php?action=profile;u=805) provided you with a workable 1.0 solution, there is the firmware as well in CALL &BB03 which Resets the Keyboard Buffer, though I try not to use because it does a few other things as well as Clearing the Keyboard Buffer when initiated.


The main difference now with the game in 1.0 and 1.1 is the SOUND. SOUND is a tough one because of the way the volume operates. In 1.0, the volume is 0 to 7 with 7 being the loudest, though 8 to 15 can be used in 1.0, but what happens is 8 is quiet again going up to 15. So 12 seems to be the best volume setting for all computers. I'm not a sound expert though, though from time to time I've used the Sound Experiment Programme For Amstrad CPC 464 (https://www.cpc-power.com/index.php?page=detail&num=10484) to create Sound FXs.



I'm not going to pretend I understand the game coding fully as I have only isolated the areas where there maybe visual problems on 464, but the adjustments are fully compatable with 1.1, when I was testing this earlier here (http://www.cpcwiki.eu/forum/programming/multicoloured-graphics-in-basic-discuss/msg175500/#msg175500). If it's no trouble saving the game to a DSK image, it would save some time Copying/Pasting & Correcting any mistakes.


One thing I noticed was when 1000 points are accumulated, a little problem occurs when the added points moves down a line leaving a line with added points in red on display as shown in this screenshot.
Ok, I think then it should be safer to wait for the game to be finished to start making different versions (I plan on releasing in all the main 8-bit plattforms: Spectrum, MSX and C-64, but first it must be finished and I must find people wanting to port it)About the code publishing: Yes, I think you´re right. I´ve modified the first post to just offer a link to the DSK. Do you think it´s better to remove the 464 code by now?About the "1000 coins bug": Yes again. I didn´t have in mind the length of that value when I coded it. I will try to find a fix for that (maybe a 999 coins limit?... don´t know, I´l work it out as I go)
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 14:15, 05 October 19
Quote from: XeNoMoRPH on 12:13, 05 October 19
https://vimeo.com/364471958 (https://vimeo.com/364471958)
Oh my goodness! You did the full copy/paste!To solve that, from now on I will be posting the DSK download link instead of the code (already posted) By the way, I was doing it like that because in RVM (the emulator I´m using) you can have a virtual disk drive where you can drag your .BAS directly, without having to copy/paste anything.
Title: Re: My roguelike in BASIC
Post by: VincentGR on 16:02, 05 October 19
I use notepad++
Sometimes the windows version does mistakes.
Title: Re: My roguelike in BASIC
Post by: AMSDOS on 21:45, 05 October 19
Quote from: PAQUITO on 14:13, 05 October 19
Ok, I think then it should be safer to wait for the game to be finished to start making different versions (I plan on releasing in all the main 8-bit plattforms: Spectrum, MSX and C-64, but first it must be finished and I must find people wanting to port it)About the code publishing: Yes, I think you´re right. I´ve modified the first post to just offer a link to the DSK. Do you think it´s better to remove the 464 code by now?


If you like, I was just showing how it could be written to work on all systems.  :)


QuoteAbout the "1000 coins bug": Yes again. I didn´t have in mind the length of that value when I coded it. I will try to find a fix for that (maybe a 999 coins limit?... don´t know, I´l work it out as I go)


Well I noticed Line 25 wasn't being used for anything in particular and thought the "+ <incremental points>" could be on that line, which would resolve that issue, but on the other hand if you had something else in mind for that line then perhaps the coin limit would be the better solution.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 22:05, 05 October 19
Quote from: AMSDOS on 21:45, 05 October 19

If you like, I was just showing how it could be written to work on all systems.  :)



Well I noticed Line 25 wasn't being used for anything in particular and thought the "+ <incremental points>" could be on that line, which would resolve that issue, but on the other hand if you had something else in mind for that line then perhaps the coin limit would be the better solution.
I have solved it removing the "x" sign besides the coin bag graphics. That gives more room for the numbers. The reason of the bug was that it writes a string of 5 blank spaces to delete the loot value. That spaces string exceeded the width of the screen, so it continued in the next row.The reason why line 25 is not used is because of the graphics of the game board. It´s a grid of 2x2 sprites, so a even number is needed, therefore... 24.
Title: Re: My roguelike in BASIC
Post by: mr_lou on 07:21, 06 October 19
Great seeing a BASIC game project. We should have more BASIC game projects.  :)

How about adding some music to this one?
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 14:55, 06 October 19
Quote from: mr_lou on 07:21, 06 October 19
Great seeing a BASIC game project. We should have more BASIC game projects.  :)

How about adding some music to this one?
That would be awesome. Sadly I have no idea about music coding or sound effects. Is that even possible in a Basic program?
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 16:53, 06 October 19
This weekend I´m not making a lot of advances. I´m trying to design the leveling up values and combat system. Playing around with dice rolls simulations. I think a 1D10+4 roll for each levelup looks good enough.

(http://www.amstrad.es/forum/download/file.php?id=5948&t=1)
Title: Re: My roguelike in BASIC
Post by: mr_lou on 00:38, 07 October 19
Quote from: PAQUITO on 14:55, 06 October 19
That would be awesome. Sadly I have no idea about music coding or sound effects. Is that even possible in a Basic program?

Absolutely. I've done quite a lot of music in BASIC over the years.
Basically you'd typically use DATA lines to hold the frequencies. And then use a ON SQ() GOSUB routine to play.
Sadly I don't have time to make you a little track, but someone else might.
Title: Re: My roguelike in BASIC
Post by: TotO on 08:21, 07 October 19
Remember some UbiSoft intro music like Zombi and M'Enfin!, really nice tunes programmed in BASIC.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 12:14, 07 October 19
Yes, I know it can be done for intros and stuff. I was thinking in background music.
Title: Re: My roguelike in BASIC
Post by: mr_lou on 12:24, 07 October 19
Quote from: PAQUITO on 12:14, 07 October 19
Yes, I know it can be done for intros and stuff. I was thinking in background music.

Yes, can also be done relative easy using the approach I described. Just have an ON SQ() GOSUB in your game loop.
Title: Re: My roguelike in BASIC
Post by: Morri on 00:03, 08 October 19
@PAQUITO (http://www.cpcwiki.eu/forum/index.php?action=profile;u=3403) I have made a few 100% BASIC games with background music (Written by @mr_lou (http://www.cpcwiki.eu/forum/index.php?action=profile;u=96) ) . CoolBox is a good example on CPCpower - https://www.cpc-power.com/index.php?page=detail&num=13102 (https://www.cpc-power.com/index.php?page=detail&num=13102)

Title: Re: My roguelike in BASIC
Post by: PAQUITO on 00:43, 08 October 19
Quote from: Morri on 00:03, 08 October 19
@PAQUITO (http://www.cpcwiki.eu/forum/index.php?action=profile;u=3403) I have made a few 100% BASIC games with background music (Written by @mr_lou (http://www.cpcwiki.eu/forum/index.php?action=profile;u=96) ) . CoolBox is a good example on CPCpower - https://www.cpc-power.com/index.php?page=detail&num=13102 (https://www.cpc-power.com/index.php?page=detail&num=13102)
Pretty cool game. And awesome music. I remember faking vertical scrolls in Basic using a return in the last row (thus, letting the machine do the rest :P) How do you do it in Basic?
Title: Re: My roguelike in BASIC
Post by: AMSDOS on 11:05, 10 October 19
Quote from: PAQUITO on 00:43, 08 October 19
Pretty cool game. And awesome music. I remember faking vertical scrolls in Basic using a return in the last row (thus, letting the machine do the rest :P ) How do you do it in Basic?


I think it was some OUT statements to Roll the Screen and use WINDOW on the sides to delete the scenery from appearing on the other side of the screen and draw the new scenery in its place.
Title: Re: My roguelike in BASIC
Post by: asertus on 15:16, 10 October 19
Actually, when it is done I'd try to embed 8bp library. You'd get an amazing game with it.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 23:31, 10 October 19
First post updated with new DSK and some minor changes. Just a little mid-week update, nothing major. Check it!
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 00:14, 12 October 19
New update! You can now finally face some enemies and strike some blows. It costed my blood and sweat to make it work, but there it is.SDK updated in the first post.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 03:01, 14 October 19
New update!
The monsters generation system had to be almost rewritten, but now it´s much more easy to edit for future updates.
This update contains some extra things, some visual incorporations, bug fixes and, in general, everything starts to be much more functional.

DSK updated in the first post!
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 22:10, 15 October 19
I need help with one question I can´t make it work.
I want to print two values in the format x/x.

I mean, about the hit points, if I have 150 hps left from a total of 300. Is there a way to print "150/300"?
I know I can always do PRINT hp;"/";hpmax. But it would give me something like "150 / 300" (with blank spaces when I want all the characters side by side) Is this possible?


I´ve been trying with PRINT USING but it doesn´t seem to be the way.
EDIT: I tried STR$, which converts a numeric value to a literal value, but it still generates a blank space at the beggining of the string :(
Title: Re: My roguelike in BASIC
Post by: Fessor on 22:59, 15 October 19
As there was no function to trim a string you have to do something like this to get rid of the first char of the string.
hp$=str$(hp):hp$=right$(hp$,len(hp$)-1)
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 23:32, 15 October 19
Quote from: Fessor on 22:59, 15 October 19
As there was no function to trim a string you have to do something like this to get rid of the first char of the string.
hp$=str$(hp):hp$=right$(hp$,len(hp$)-1)
Yes, I used that string trimming approach to generate the gameboard out of a bunch of DATA lines. I will try that.
EDIT: Yay! it totally works! Thanks!
(https://i.postimg.cc/KYSZDTsP/IMG-20191016-005101.jpg) (https://postimg.cc/68cJ98Kq)
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 23:58, 15 October 19
Quote from: asertus on 15:16, 10 October 19
Actually, when it is done I'd try to embed 8bp library. You'd get an amazing game with it.
I´ll make sure to give you a touch when it´s finished.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 19:25, 17 October 19
New version! A lot of new things and interesting things. Check it in the first post.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 22:44, 17 October 19
Quick question: The game is by now in Spanish. Are you having trouble understanding it? I can change it to english if you want.
Title: Re: My roguelike in BASIC
Post by: VincentGR on 07:44, 18 October 19
Quote from: PAQUITO on 22:44, 17 October 19
Quick question: The game is by now in Spanish. Are you having trouble understanding it? I can change it to english if you want.


That would be great.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 19:29, 18 October 19
Quote from: VincentGR on 07:44, 18 October 19

That would be great.
Done. Please find the updated link to the DSK now in english in the first post.
Title: Re: My roguelike in BASIC
Post by: VincentGR on 19:43, 18 October 19
Thanks!!!


Can't wait for the final release  :)
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 21:57, 18 October 19
Sadly, I only can invest a few hours after work, so it´s growing slowly. This weekend I want to code an AI to make enemies that actually chase you (not only walk around at random like the rats)
Title: Re: My roguelike in BASIC
Post by: AMSDOS on 22:05, 18 October 19
Quote from: PAQUITO on 21:57, 18 October 19Sadly, I only can invest a few hours after work, so it´s growing slowly. This weekend I want to code an AI to make enemies that actually chase you (not only walk around at random like the rats)



The last example of code I posted in my Collision Detection thread (http://www.cpcwiki.eu/forum/programming/collision-detection/msg174827/#msg174827) is from an old AA Type-In called Lawn Mower Simulator, in that game there is a Person who follows the Lawn Mower around the screen which maybe of some help if you want things chasing you.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 22:14, 18 October 19
Quote from: AMSDOS on 22:05, 18 October 19



The last example of code I posted in my Collision Detection thread (http://www.cpcwiki.eu/forum/programming/collision-detection/msg174827/#msg174827) is from an old AA Type-In called Lawn Mower Simulator, in that game there is a Person who follows the Lawn Mower around the screen which maybe of some help if you want things chasing you.

The real challenge will not be monsters chasing you, but monsters chasing you and finding a way through obstacles
Title: Re: My roguelike in BASIC
Post by: VincentGR on 22:32, 18 October 19
Can't wait to play when it's done, don't worry  ;D
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 18:52, 20 October 19
I´m having a very dense research task this whole weekend, since finding a way to make the enemies chase you while avoiding obstacles is being really tricky.After taking a look at some classic maze solving programming methods, I´m starting to find a way to calculate paths between two squares of the game grid. I think I have something. Right now I´m trying to write a pathfinder program to see if it works as expected so I can implement it in the game.
Anyways it´s being really interesting to develop. It involves things like tracing primary paths from the two points, checking for intersections, etc... Let´s see if I can make it work :)
(https://i.postimg.cc/qq6PCrX4/PATHFINDER.jpg) (https://postimages.org/)
Title: Re: My roguelike in BASIC
Post by: robcfg on 19:28, 20 October 19
Have you considered the A* pathfinding algorithm?
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 19:57, 20 October 19
Quote from: robcfg on 19:28, 20 October 19
Have you considered the A* pathfinding algorithm?
I had a look at that algorithm amongst many others. Problem is, the A* uses a much complicated math from what I can handle. The other methods are great, but they all imply that you´re in an actual labyrinth, meaning corridors 1 square width, so it´s very easy to find paths. My gameboard is different since it´s mainly an empty area with some obstacles scattered, so there are no real corridors.
Title: Re: My roguelike in BASIC
Post by: SRS on 21:20, 20 October 19
Watching your progress with joy.
What I see is you are using very long variable names. Those "waste" a lot of space (and time for interpreter) on a CPC

-> see RAM excerpt


I recommend to shorten them for more free RAM and speed :)

Title: Re: My roguelike in BASIC
Post by: PAQUITO on 21:43, 20 October 19
Quote from: SRS on 21:20, 20 October 19
Watching your progress with joy.
What I see is you are using very long variable names. Those "waste" a lot of space (and time for interpreter) on a CPC

-> see RAM excerpt


I recommend to shorten them for more free RAM and speed :)
Well, it´s a balance between length and readability. Obviously, for the player strength an optimal variable name would be something like "ps", but that would have me reading a list of references to understand what I´m seeing, so I tend to name it something more like "player_str" or something similar. But yes, I know you´re right.
EDIT: Maybe a solution would be keep coding with long variables and shorten them once the game is finished (I´m using sublime, so it wouldn´t be difficult to do)
Title: Re: My roguelike in BASIC
Post by: SRS on 20:03, 21 October 19
Source from 17.10.2019 - 3650 Bytes less :)
10 ' 8 BIT DUNGEONS
20 ' BY JNL
30 ' SEPT 2019
40 '
50 ' INICIALIZA VARIABLES NUMERICAS
51 INK 0,0:INK 1,25:MODE 1:BORDER 0:PAPER 0:PEN 1
61 INPUT"NAME:",N$:N$=UPPER$(N$):IF LEN(N$)>7 THEN PRINT"7 characters maximum":GOTO 61 ELSE 70
63 IF N$=""THEN 61
70 CLS:WINDOW#2,1,26,1,25:WINDOW#3,28,40,7,11:P2=1:D5=0:F=100:D2=100:H0=100:H=100:M2=1:'
120 ' DEFINE GRAFICOS
130 SYMBOL AFTER 48:' TIPOGRAFIA
150 SYMBOL 48,28,38,102,102,102,100,56,0:SYMBOL 49,16,56,24,24,24,24,16,0:SYMBOL 50,56,92,8,16,32,68,124,0:SYMBOL 51,124,72,16,60,12,8,16,32:SYMBOL 52,12,28,44,76,126,12,12,8:SYMBOL 53,30,36,112,56,28,12,68,56:SYMBOL 54,56,96,104,124,108,108,56,0
220 SYMBOL 55,124,100,8,8,16,16,48,24:SYMBOL 56,60,102,100,24,38,102,60,0:SYMBOL 57,60,102,102,110,118,38,4,24:SYMBOL 65,2,54,78,86,38,86,142,0:SYMBOL 67,58,86,208,208,208,82,60,0:SYMBOL 69,222,100,104,124,100,64,254,0
280 SYMBOL 72,64,228,110,118,102,103,102,4:SYMBOL 76,12,54,112,176,48,34,126,0:SYMBOL 77,74,254,106,106,106,107,74,0:SYMBOL 79,60,70,214,238,198,196,120,0:SYMBOL 80,44,246,102,102,118,236,96,240:SYMBOL 82,54,91,49,50,60,54,243,0
340 SYMBOL 83,58,68,200,124,38,98,188,0:SYMBOL 84,122,174,104,104,104,106,60,0:SYMBOL 85,68,238,102,102,102,111,50,0:SYMBOL 86,68,238,118,102,102,54,28,0:' GRAFICOS
390 SYMBOL 221,60,126,175,211,165,243,118,60:SYMBOL 222,126,126,126,126,126,126,60,24:SYMBOL 223,0,108,254,254,124,56,16,0:SYMBOL 224,0,6,14,220,120,48,88,136:SYMBOL 225,16,4,0,8,77,3,231,255:SYMBOL 226,0,140,204,208,224,232,252,224
450 SYMBOL 227,63,15,103,111,13,24,0,4:SYMBOL 228,242,254,252,224,224,244,224,0:SYMBOL 229,0,0,28,29,15,151,127,4:SYMBOL 230,1,1,226,244,248,248,248,40:SYMBOL 231,0,0,0,0,0,0,195,239:SYMBOL 232,0,0,0,0,48,240,224,192
510 SYMBOL 233,223,239,223,239,223,227,192,0:SYMBOL 234,255,255,232,232,208,160,0,0:SYMBOL 235,1,7,14,28,58,60,62,28:SYMBOL 236,224,216,220,108,240,120,184,112:SYMBOL 237,0,254,252,248,240,248,252,254:SYMBOL 238,0,127,63,31,15,31,63,127
570 SYMBOL 239,0,255,255,255,255,255,255,255:SYMBOL 240,1,35,119,119,113,116,115,114:SYMBOL 241,0,128,192,192,192,128,63,187:SYMBOL 242,249,6,119,15,15,15,60,30:SYMBOL 243,49,187,59,187,191,222,236,112:SYMBOL 244,85,254,255,254,255,254,255,254
630 SYMBOL 245,85,255,255,255,255,255,255,255:SYMBOL 246,253,170,127,255,255,255,255,127:SYMBOL 247,127,170,255,255,255,255,255,254:SYMBOL 248,83,238,217,181,181,109,125,109:SYMBOL 249,193,113,153,172,172,182,190,182
680 SYMBOL 250,121,102,118,105,125,109,125,109:SYMBOL 251,190,182,190,182,190,182,190,182:SYMBOL 252,31,55,59,0,59,59,59,59:SYMBOL 253,248,252,204,0,204,252,252,252:SYMBOL 254,0,0,6,73,249,6,0,0:'
740 ' DEFINE VARIABLES DE LOS SPRITES
750 R0$=STRING$(2,8)+CHR$(10):B0$="  "+R0$+"  ":G0$=CHR$(15)+CHR$(1)+CHR$(240)+CHR$(241)+STRING$(2,8)+CHR$(10)+CHR$(242)+CHR$(243):M3$=CHR$(15)+CHR$(1)+CHR$(244)+CHR$(245)+STRING$(2,8)+CHR$(10)+CHR$(246)+CHR$(247)
790 P5$=CHR$(15)+CHR$(2)+CHR$(248)+CHR$(249)+R0$+CHR$(250)+CHR$(251):C7$=CHR$(15)+CHR$(1)+"  "+R0$+CHR$(252)+CHR$(253):L1$=CHR$(15)+CHR$(2)+"  "+R0$+" "+CHR$(254):C4$=CHR$(15)+CHR$(3)+CHR$(238)+CHR$(239):C3$=CHR$(15)+CHR$(3)+CHR$(239)+CHR$(237)
840 B1$=CHR$(15)+CHR$(1)+"  "+R0$+CHR$(235)+CHR$(236):M$=CHR$(15)+CHR$(2)+CHR$(231)+CHR$(232)+R0$+CHR$(233)+CHR$(234):R$=CHR$(15)+CHR$(1)+"  "+R0$+CHR$(229)+CHR$(230):G$=CHR$(15)+CHR$(3)+CHR$(225)+CHR$(226)+R0$+CHR$(227)+CHR$(228)
880 xp$=CHR$(15)+CHR$(3)+"  "+R0$+" "+CHR$(221):E1$=CHR$(15)+CHR$(2)+"  "+R0$+" "+CHR$(222):C8$=CHR$(15)+CHR$(3)+"  "+R0$+" "+CHR$(223):E2$=CHR$(15)+CHR$(2)+"  "+R0$+" "+CHR$(224):'
930 ' DIBUJA PANTALLA DE JUEGO
940 GOSUB 1660:FOR y=1 TO 12:FOR x=1 TO 13:IF C$(x,y)="*"THEN PAPER 0:LOCATE(x*2)-1,(y*2)-1:PRINT M3$
980 IF C$(x,y)="F"THEN PAPER 0:LOCATE(x*2)-1,(y*2)-1:PRINT P5$
990 NEXT x:NEXT y:LOCATE 30,1:PAPER 3:PEN 0:PRINT"         ":LOCATE 29,2:PAPER 0:PEN 3:PRINT C4$+"       "+C3$:LOCATE 31,1:PAPER 3:PEN 0:PRINT N$:LOCATE 28,4:PAPER 0:PRINT G0$:LOCATE 31,4:PRINT"LV 06":H0$=STR$(H0):H0$=RIGHT$(H0$,LEN(H0$)-1):H$=STR$(H)
1052 H$=RIGHT$(H$,LEN(H$)-1):LOCATE 31,5:PRINT"HP ";H0$;"/";H$:LOCATE 28,23:PRINT B1$;D5:LOCATE 32,14:PRINT CHR$(224);F:LOCATE 32,15:PRINT CHR$(222);D2:LOCATE 32,16:PRINT CHR$(221);X0:LOCATE 13,25:PAPER 3:PEN 0:PRINT P2:'
1130 PAPER 0:' DECIDE POSICION ALEATORIA DE JUGADOR Y LLAVE. LOS DIBUJA
1150 x=INT(RND*11)+2:y=INT(RND*10)+2:C$(x,y)="J":LOCATE(x*2)-1,(y*2)-1:PEN 1:PRINT G0$
1180 L=INT(RND*11)+2:L0=INT(RND*10)+2:IF C$(L,L0)<>"."THEN 1180
1200 C$(L,L0)="K":LOCATE(L*2)-1,(L0*2)-1:PRINT L1$:'
1230 ' DECIDE POSICION ALEATORIA DE COFRE Y LO DIBUJA
1240 C5=INT(RND*11)+2:C6=INT(RND*10)+2:IF C$(C5,C6)<>"."THEN 1240
1260 C$(C5,C6)="C":LOCATE(C5*2)-1,(C6*2)-1:PAPER 0:PRINT C7$:'
1263 ' COLOCA RATAS AL AZAR
1264 ' cuantas ratas? (entre 3 y 6)
1265 E=INT((RND*5)+2):M1=E:FOR E0=1 TO E
1300 E(E0)=INT(RND*9)+2:E0(E0)=INT(RND*9)+2:IF C$(E(E0),E0(E0))<>"."THEN 1300
1311 F(E0)=100:D(E0)=100:H(E0)=100:X(E0)=50:C$(E(E0),E0(E0))="1":LOCATE(E(E0)*2)-1,(E0(E0)*2)-1:PAPER 0:PRINT R$:I$(E0)="RAT":NEXT E0:'
1340 ' CALCULA OBSTACULOS AL AZAR Y LOS DIBUJA
1350 FOR C1=3 TO 10:FOR C0=3 TO 11:IF C$(C0,C1)<>"."THEN 1400
1380 RANDOMIZE RND:=INT(RND*4):IF<>1 THEN 1400
1390 LOCATE(C0*2)-1,(C1*2)-1:PAPER 0:PRINT M3$:C$(C0,C1)="*"
1400 NEXT C0:NEXT C1:'
1421 ' ESPERA TECLAS DEL JUGADOR
1430 GOSUB 2260
1440 C$(x,y)="J":CLEAR INPUT
1450 LOCATE 31,8:PRINT"STEPS:":LOCATE 28,9:PRINT"<SPACE> END":IF M1<>0 THEN PAPER 0:PEN 1:LOCATE 37,8:PRINT P1 ELSE 1453
1453 a$=INKEY$:IF a$=""THEN 1450
1460 IF a$=CHR$(240)THEN D3=x:D4=y-1:GOTO 1520
1470 IF a$=CHR$(241)THEN D3=x:D4=y+1:GOTO 1520
1480 IF a$=CHR$(242)THEN D3=x-1:D4=y:GOTO 1520
1490 IF a$=CHR$(243)THEN D3=x+1:D4=y:GOTO 1520
1491 IF a$=" "THEN M2=0:CLS#3:GOTO 2270 ELSE 1500
1500 GOTO 1453:'
1520 ' movim JUGADOR
1530 IF C$(D3,D4)="*"THEN 1450
1540 IF C$(D3,D4)="1"THEN 2680
1550 IF C$(D3,D4)="F"AND L1=1 THEN 1960
1560 IF C$(D3,D4)="F"AND L1=0 THEN 1450
1570 IF C$(D3,D4)="K"THEN L1=1:C$(D3,D4)=".":SOUND 1,150,10:SOUND 1,50,10
1580 IF C$(D3,D4)="C"THEN 2060
1590 IF C$(D3,D4)="$"THEN 2130
1600 LOCATE(x*2)-1,(y*2)-1:PRINT B0$:C$(x,y)=".":x=D3:y=D4:C$(x,y)="J":LOCATE(x*2)-1,(y*2)-1:PRINT G0$:SOUND 1,4000,1:SOUND 1,4000,1
1630 P1=P1-1:IF P1=0 AND M1<>0 THEN 2520
1640 GOTO 1440:'
1660 ' DEFINE CUADRICULA DEL MAPA
1670 DIM C$(14,13):DIM M$(12):M$(1)="*************":M$(2)="*...........*":M$(3)="*...........*":M$(4)="*...........*":M$(5)="*...........*":M$(6)="*...........*":M$(7)="*...........*":M$(="*...........*":M$(9)="*...........*"
1770 M$(10)="*...........*":M$(11)="*...........*":M$(12)="*************":FOR C1=1 TO 12:FOR C0=1 TO 13:C$(C0,C1)=MID$(M$(C1),C0,1):NEXT C0:NEXT C1:'
1860 ' DECIDE POSICION ALEATORIA DE LA PUERTA Y LA ESTABLECE COMO PUNTO DE ESCAPE
1870 RANDOMIZE TIME:RANDOMIZE RND:P=INT(RND*4):IF P=0 THEN P4=1:P3=(INT(RND*11))+2
1900 IF P=1 THEN P3=13:P4=(INT(RND*10))+2
1910 IF P=2 THEN P4=12:P3=(INT(RND*11))+2
1920 IF P=3 THEN P3=1:P4=(INT(RND*10))+2
1930 C$(P3,P4)="F":RETURN:'
1960 ' AVANZAR UNA FASE
1970 LOCATE(x*2)-1,(y*2)-1:PRINT B0$:LOCATE(P3*2)-1,(P4*2)-1:PRINT G0$:ENV 1,5,3,20:SOUND 1,478,0,0,1:FOR E3=1 TO 500:NEXT E3:ERASE C2$,M0$:L1=0:P2=P2+1:WINDOW SWAP 0,2:FOR S=1 TO 25:LOCATE 1,25:PRINT CHR$(10):NEXT:WINDOW SWAP 0,2:CLS#3:GOTO 930
2060 '
2070 ' ABRE COFRE Y GENERA DINERO AL AZAR
2080 B1=INT(RND*99)+1:LOCATE(D3*2)-1,(D4*2)-1:PRINT B1$:C$(D3,D4)="$":GOTO 1450:'
2130 ' COGE EL DINERO
2140 LOCATE(x*2)-1,(y*2)-1:PRINT B0$:LOCATE(D3*2)-1,(D4*2)-1:PRINT G0$:C$(x,y)=".":x=D3:y=D4:FOR E3=1 TO 50:NEXT E3:LOCATE 30,24:PRINT CHR$(15)+CHR$(1);D5;CHR$(15)+CHR$(3);"+";B1:FOR E3=1 TO 1000:NEXT E3:FOR C9=D5 TO(D5+B1)STEP 2:LOCATE 30,24
2210 PRINT CHR$(15)+CHR$(1);C9;CHR$(15)+CHR$(3);"+";B1:SOUND 1,150,1:NEXT C9:D5=D5+B1:LOCATE 30,24:PRINT CHR$(15)+CHR$(1);D5;"    ";:GOTO 1630
2260 '
2270 ' MENU
2271 E0=0:O$(1)="PASS TURN":O$(2)="MOVE":O$(3)="ATTACK":O$(4)="USE":FOR O1=1 TO 4:PAPER 0:PEN 1:LOCATE 32,O1+7:PRINT O$(O1):NEXT O1:LOCATE 30,7:PRINT M$:O1=1
2350 LOCATE 30,O1+6:PRINT M$:LOCATE 32,O1+7:PAPER 2:PEN 0:PRINT O$(O1)
2370 a$=INKEY$:IF a$=""THEN 2370
2380 IF a$=CHR$(240)THEN 2420
2390 IF a$=CHR$(241)THEN 2460
2400 IF a$=" "AND O1=1 THEN 2530
2401 IF a$=" "AND O1=2 THEN 2500
2410 GOTO 2370
2420 IF O1=1 THEN 2370
2430 PAPER 0:LOCATE 30,O1+6:PRINT B0$:PEN 1:PAPER 0:LOCATE 32,O1+7:PRINT O$(O1):O1=O1-1:GOTO 2350
2460 IF O1=4 THEN 2370
2470 PAPER 0:LOCATE 30,O1+6:PRINT B0$:PEN 1:PAPER 0:LOCATE 32,O1+7:PRINT O$(O1):O1=O1+1:GOTO 2350
2500 IF M2=0 THEN 2370 ELSE M2=1
2501 PAPER 1:CLS#3:P1=5:PAPER 0:GOTO 1450
2520 '
2530 ' MOVIMIENTO ENEMIGOS
2531 IF M1=0 THEN 1440
2532 PAPER 0:CLS#3:FOR E0=1 TO E:IF H(E0)<1 THEN 2661
2542 B=0:IF C$(E(E0),E0(E0)-1)<>"."THEN B=B+1
2544 IF C$(E(E0)+1,E0(E0))<>"."THEN B=B+1
2545 IF C$(E(E0),E0(E0)+1)<>"."THEN B=B+1
2546 IF C$(E(E0)-1,E0(E0))<>"."THEN B=B+1
2547 IF B=4 THEN 2661
2548 FOR P0=1 TO 4
2550 RANDOMIZE TIME:C=INT(RND*4)+1:IF C=1 AND C$(E(E0),E0(E0)-1)<>"."THEN 2550
2570 IF C=2 AND C$(E(E0)+1,E0(E0))<>"."THEN 2550
2580 IF C=3 AND C$(E(E0),E0(E0)+1)<>"."THEN 2550
2590 IF C=4 AND C$(E(E0)-1,E0(E0))<>"."THEN 2550
2600 LOCATE(E(E0)*2)-1,(E0(E0)*2)-1:PRINT B0$:C$(E(E0),E0(E0))=".":IF C=1 THEN E0(E0)=E0(E0)-1
2620 IF C=2 THEN E(E0)=E(E0)+1
2630 IF C=3 THEN E0(E0)=E0(E0)+1
2640 IF C=4 THEN E(E0)=E(E0)-1
2650 C$(E(E0),E0(E0))="1":LOCATE(E(E0)*2)-1,(E0(E0)*2)-1:PRINT R$:NEXT P0
2661 NEXT E0:M2=1:GOTO 2270
2680 '
2681 ' ATAQUE JUGADOR
2682 ' CALCULA DAO:
2683 ' 1. a quien estamos atacando?
2684 '
2685 FOR E0=1 TO E:IF D3=E(E0)AND D4=E0(E0)THEN O=E0
2687 NEXT E0:'
2699 ' 2. cuanto dao le hacemos?
2700 '
2750 D=INT(RND*(F/2)):A0=F+D:D=INT(RND*(D(O)/2)):D0=D(O)+D:G=A0-D0:IF A0>D0 THEN GOSUB 4000 ELSE GOSUB 4170
2791 IF H(O)<1 THEN 6000
2830 '
2840 ' CONTRAATAQUE DEL ENEMIGO
2860 D=INT(RND*(F(O)/2)):A0=F(O)+D:D=INT(RND*(D2/2)):D0=D1+D:G=A0-D0:IF A0>D0 THEN GOSUB 4100 ELSE GOSUB 5000
2910 IF H(O)<1 THEN GOSUB 6000 ELSE 2530
4000 ' ANIMACION ATAQUE EXITOSO DEL JUGADOR
4010 LOCATE(D3*2)-1,(D4*2)-1:PRINT G$:ENV 1,11,-1,5:ENT 1,9,49,5,9,-10,15:SOUND 3,145,100,12,1,1,12:FOR E3=1 TO 1000:NEXT E3:LOCATE(D3*2)-1,(D4*2)-1:PRINT R$:H(O)=H(O)-G:RETURN
4100 ' ANIMACION ATAQUE EXITOSO DEL ENEMIGO
4110 LOCATE(x*2)-1,(y*2)-1:PRINT G$:ENV 1,11,-1,5:ENT 1,9,49,5,9,-10,15:SOUND 3,145,100,12,1,1,12:FOR E3=1 TO 1000:NEXT E3:LOCATE(x*2)-1,(y*2)-1:PRINT G0$:LOCATE 33,6:PAPER 0:PEN 3:PRINT G*(-1):H0=H0-G
4151 IF H0<1 THEN LOCATE 33,5:PAPER 0:PEN 1:PRINT" 0  ":GOTO 7000 ELSE 4152
4152 H0$=STR$(H0):H0$=RIGHT$(H0$,LEN(H0$)-1):H$=STR$(H):H$=RIGHT$(H$,LEN(H$)-1):PAPER 0:PEN 1:LOCATE 34,5:PRINT H0$;"/";H$;" ":CLS#3:RETURN
4170 ' ANIMACION ATAQUE FALLIDO DEL JUGADOR
4180 PRINT CHR$(7):RETURN
5000 ' ANIMACION ATAQUE FALLIDO DEL ENEMIGO
5010 PRINT CHR$(7):RETURN
6000 '
6010 ' BORRA ENEMIGO MUERTO Y LIBERA SU CASILLA
6020 LOCATE(D3*2)-1,(D4*2)-1:PRINT B0$:C$(D3,D4)=".":M1=M1-1:'
6060 ' suma experiencia al jugador
6070 FOR C9=1 TO X(O)STEP 2:LOCATE 33,16:PRINT X0+C9:SOUND 1,150,1:NEXT C9:X0=X0+X(O):LOCATE 33,16:PRINT X0:GOTO 2530
7000 '
7010 ' GAME OVER
7020 PAPER 0:CLS:PRINT N$;" HAS BEEN SLAINED BY A ";I$(O):PRINT"IN FLOOR ";P2:PRINT"YOUR MANAGED TO LOOT ";D5;"COINS":PRINT:PRINT"PRESS ANY KEY TO RESTART...":CALL &BB18:RUN
using AMSTRAD TOOLKIT from BEEBUGSOFT
Title: Re: My roguelike in BASIC
Post by: mr_lou on 20:13, 21 October 19
Quote from: SRS on 21:20, 20 October 19What I see is you are using very long variable names. Those "waste" a lot of space (and time for interpreter) on a CPC
I recommend to shorten them for more free RAM and speed :)

JavaME has obfuscators for this.
Could be fun to have something like that for CPC BASIC stuff to; a tool that runs through the source to shorten variable names and such.  :)
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 01:28, 22 October 19
Quote from: SRS on 20:03, 21 October 19
Source from 17.10.2019 - 3650 Bytes less :)
10 ' 8 BIT DUNGEONS
20 ' BY JNL
30 ' SEPT 2019
40 '
50 ' INICIALIZA VARIABLES NUMERICAS
51 INK 0,0:INK 1,25:MODE 1:BORDER 0:PAPER 0:PEN 1
61 INPUT"NAME:",N$:N$=UPPER$(N$):IF LEN(N$)>7 THEN PRINT"7 characters maximum":GOTO 61 ELSE 70
63 IF N$=""THEN 61
70 CLS:WINDOW#2,1,26,1,25:WINDOW#3,28,40,7,11:P2=1:D5=0:F=100:D2=100:H0=100:H=100:M2=1:'
120 ' DEFINE GRAFICOS
130 SYMBOL AFTER 48:' TIPOGRAFIA
150 SYMBOL 48,28,38,102,102,102,100,56,0:SYMBOL 49,16,56,24,24,24,24,16,0:SYMBOL 50,56,92,8,16,32,68,124,0:SYMBOL 51,124,72,16,60,12,8,16,32:SYMBOL 52,12,28,44,76,126,12,12,8:SYMBOL 53,30,36,112,56,28,12,68,56:SYMBOL 54,56,96,104,124,108,108,56,0
220 SYMBOL 55,124,100,8,8,16,16,48,24:SYMBOL 56,60,102,100,24,38,102,60,0:SYMBOL 57,60,102,102,110,118,38,4,24:SYMBOL 65,2,54,78,86,38,86,142,0:SYMBOL 67,58,86,208,208,208,82,60,0:SYMBOL 69,222,100,104,124,100,64,254,0
280 SYMBOL 72,64,228,110,118,102,103,102,4:SYMBOL 76,12,54,112,176,48,34,126,0:SYMBOL 77,74,254,106,106,106,107,74,0:SYMBOL 79,60,70,214,238,198,196,120,0:SYMBOL 80,44,246,102,102,118,236,96,240:SYMBOL 82,54,91,49,50,60,54,243,0
340 SYMBOL 83,58,68,200,124,38,98,188,0:SYMBOL 84,122,174,104,104,104,106,60,0:SYMBOL 85,68,238,102,102,102,111,50,0:SYMBOL 86,68,238,118,102,102,54,28,0:' GRAFICOS
390 SYMBOL 221,60,126,175,211,165,243,118,60:SYMBOL 222,126,126,126,126,126,126,60,24:SYMBOL 223,0,108,254,254,124,56,16,0:SYMBOL 224,0,6,14,220,120,48,88,136:SYMBOL 225,16,4,0,8,77,3,231,255:SYMBOL 226,0,140,204,208,224,232,252,224
450 SYMBOL 227,63,15,103,111,13,24,0,4:SYMBOL 228,242,254,252,224,224,244,224,0:SYMBOL 229,0,0,28,29,15,151,127,4:SYMBOL 230,1,1,226,244,248,248,248,40:SYMBOL 231,0,0,0,0,0,0,195,239:SYMBOL 232,0,0,0,0,48,240,224,192
510 SYMBOL 233,223,239,223,239,223,227,192,0:SYMBOL 234,255,255,232,232,208,160,0,0:SYMBOL 235,1,7,14,28,58,60,62,28:SYMBOL 236,224,216,220,108,240,120,184,112:SYMBOL 237,0,254,252,248,240,248,252,254:SYMBOL 238,0,127,63,31,15,31,63,127
570 SYMBOL 239,0,255,255,255,255,255,255,255:SYMBOL 240,1,35,119,119,113,116,115,114:SYMBOL 241,0,128,192,192,192,128,63,187:SYMBOL 242,249,6,119,15,15,15,60,30:SYMBOL 243,49,187,59,187,191,222,236,112:SYMBOL 244,85,254,255,254,255,254,255,254
630 SYMBOL 245,85,255,255,255,255,255,255,255:SYMBOL 246,253,170,127,255,255,255,255,127:SYMBOL 247,127,170,255,255,255,255,255,254:SYMBOL 248,83,238,217,181,181,109,125,109:SYMBOL 249,193,113,153,172,172,182,190,182
680 SYMBOL 250,121,102,118,105,125,109,125,109:SYMBOL 251,190,182,190,182,190,182,190,182:SYMBOL 252,31,55,59,0,59,59,59,59:SYMBOL 253,248,252,204,0,204,252,252,252:SYMBOL 254,0,0,6,73,249,6,0,0:'
740 ' DEFINE VARIABLES DE LOS SPRITES
750 R0$=STRING$(2,8)+CHR$(10):B0$="  "+R0$+"  ":G0$=CHR$(15)+CHR$(1)+CHR$(240)+CHR$(241)+STRING$(2,8)+CHR$(10)+CHR$(242)+CHR$(243):M3$=CHR$(15)+CHR$(1)+CHR$(244)+CHR$(245)+STRING$(2,8)+CHR$(10)+CHR$(246)+CHR$(247)
790 P5$=CHR$(15)+CHR$(2)+CHR$(248)+CHR$(249)+R0$+CHR$(250)+CHR$(251):C7$=CHR$(15)+CHR$(1)+"  "+R0$+CHR$(252)+CHR$(253):L1$=CHR$(15)+CHR$(2)+"  "+R0$+" "+CHR$(254):C4$=CHR$(15)+CHR$(3)+CHR$(238)+CHR$(239):C3$=CHR$(15)+CHR$(3)+CHR$(239)+CHR$(237)
840 B1$=CHR$(15)+CHR$(1)+"  "+R0$+CHR$(235)+CHR$(236):M$=CHR$(15)+CHR$(2)+CHR$(231)+CHR$(232)+R0$+CHR$(233)+CHR$(234):R$=CHR$(15)+CHR$(1)+"  "+R0$+CHR$(229)+CHR$(230):G$=CHR$(15)+CHR$(3)+CHR$(225)+CHR$(226)+R0$+CHR$(227)+CHR$(228)
880 xp$=CHR$(15)+CHR$(3)+"  "+R0$+" "+CHR$(221):E1$=CHR$(15)+CHR$(2)+"  "+R0$+" "+CHR$(222):C8$=CHR$(15)+CHR$(3)+"  "+R0$+" "+CHR$(223):E2$=CHR$(15)+CHR$(2)+"  "+R0$+" "+CHR$(224):'
930 ' DIBUJA PANTALLA DE JUEGO
940 GOSUB 1660:FOR y=1 TO 12:FOR x=1 TO 13:IF C$(x,y)="*"THEN PAPER 0:LOCATE(x*2)-1,(y*2)-1:PRINT M3$
980 IF C$(x,y)="F"THEN PAPER 0:LOCATE(x*2)-1,(y*2)-1:PRINT P5$
990 NEXT x:NEXT y:LOCATE 30,1:PAPER 3:PEN 0:PRINT"         ":LOCATE 29,2:PAPER 0:PEN 3:PRINT C4$+"       "+C3$:LOCATE 31,1:PAPER 3:PEN 0:PRINT N$:LOCATE 28,4:PAPER 0:PRINT G0$:LOCATE 31,4:PRINT"LV 06":H0$=STR$(H0):H0$=RIGHT$(H0$,LEN(H0$)-1):H$=STR$(H)
1052 H$=RIGHT$(H$,LEN(H$)-1):LOCATE 31,5:PRINT"HP ";H0$;"/";H$:LOCATE 28,23:PRINT B1$;D5:LOCATE 32,14:PRINT CHR$(224);F:LOCATE 32,15:PRINT CHR$(222);D2:LOCATE 32,16:PRINT CHR$(221);X0:LOCATE 13,25:PAPER 3:PEN 0:PRINT P2:'
1130 PAPER 0:' DECIDE POSICION ALEATORIA DE JUGADOR Y LLAVE. LOS DIBUJA
1150 x=INT(RND*11)+2:y=INT(RND*10)+2:C$(x,y)="J":LOCATE(x*2)-1,(y*2)-1:PEN 1:PRINT G0$
1180 L=INT(RND*11)+2:L0=INT(RND*10)+2:IF C$(L,L0)<>"."THEN 1180
1200 C$(L,L0)="K":LOCATE(L*2)-1,(L0*2)-1:PRINT L1$:'
1230 ' DECIDE POSICION ALEATORIA DE COFRE Y LO DIBUJA
1240 C5=INT(RND*11)+2:C6=INT(RND*10)+2:IF C$(C5,C6)<>"."THEN 1240
1260 C$(C5,C6)="C":LOCATE(C5*2)-1,(C6*2)-1:PAPER 0:PRINT C7$:'
1263 ' COLOCA RATAS AL AZAR
1264 ' cuantas ratas? (entre 3 y 6)
1265 E=INT((RND*5)+2):M1=E:FOR E0=1 TO E
1300 E(E0)=INT(RND*9)+2:E0(E0)=INT(RND*9)+2:IF C$(E(E0),E0(E0))<>"."THEN 1300
1311 F(E0)=100:D(E0)=100:H(E0)=100:X(E0)=50:C$(E(E0),E0(E0))="1":LOCATE(E(E0)*2)-1,(E0(E0)*2)-1:PAPER 0:PRINT R$:I$(E0)="RAT":NEXT E0:'
1340 ' CALCULA OBSTACULOS AL AZAR Y LOS DIBUJA
1350 FOR C1=3 TO 10:FOR C0=3 TO 11:IF C$(C0,C1)<>"."THEN 1400
1380 RANDOMIZE RND:=INT(RND*4):IF<>1 THEN 1400
1390 LOCATE(C0*2)-1,(C1*2)-1:PAPER 0:PRINT M3$:C$(C0,C1)="*"
1400 NEXT C0:NEXT C1:'
1421 ' ESPERA TECLAS DEL JUGADOR
1430 GOSUB 2260
1440 C$(x,y)="J":CLEAR INPUT
1450 LOCATE 31,8:PRINT"STEPS:":LOCATE 28,9:PRINT"<SPACE> END":IF M1<>0 THEN PAPER 0:PEN 1:LOCATE 37,8:PRINT P1 ELSE 1453
1453 a$=INKEY$:IF a$=""THEN 1450
1460 IF a$=CHR$(240)THEN D3=x:D4=y-1:GOTO 1520
1470 IF a$=CHR$(241)THEN D3=x:D4=y+1:GOTO 1520
1480 IF a$=CHR$(242)THEN D3=x-1:D4=y:GOTO 1520
1490 IF a$=CHR$(243)THEN D3=x+1:D4=y:GOTO 1520
1491 IF a$=" "THEN M2=0:CLS#3:GOTO 2270 ELSE 1500
1500 GOTO 1453:'
1520 ' movim JUGADOR
1530 IF C$(D3,D4)="*"THEN 1450
1540 IF C$(D3,D4)="1"THEN 2680
1550 IF C$(D3,D4)="F"AND L1=1 THEN 1960
1560 IF C$(D3,D4)="F"AND L1=0 THEN 1450
1570 IF C$(D3,D4)="K"THEN L1=1:C$(D3,D4)=".":SOUND 1,150,10:SOUND 1,50,10
1580 IF C$(D3,D4)="C"THEN 2060
1590 IF C$(D3,D4)="$"THEN 2130
1600 LOCATE(x*2)-1,(y*2)-1:PRINT B0$:C$(x,y)=".":x=D3:y=D4:C$(x,y)="J":LOCATE(x*2)-1,(y*2)-1:PRINT G0$:SOUND 1,4000,1:SOUND 1,4000,1
1630 P1=P1-1:IF P1=0 AND M1<>0 THEN 2520
1640 GOTO 1440:'
1660 ' DEFINE CUADRICULA DEL MAPA
1670 DIM C$(14,13):DIM M$(12):M$(1)="*************":M$(2)="*...........*":M$(3)="*...........*":M$(4)="*...........*":M$(5)="*...........*":M$(6)="*...........*":M$(7)="*...........*":M$(="*...........*":M$(9)="*...........*"
1770 M$(10)="*...........*":M$(11)="*...........*":M$(12)="*************":FOR C1=1 TO 12:FOR C0=1 TO 13:C$(C0,C1)=MID$(M$(C1),C0,1):NEXT C0:NEXT C1:'
1860 ' DECIDE POSICION ALEATORIA DE LA PUERTA Y LA ESTABLECE COMO PUNTO DE ESCAPE
1870 RANDOMIZE TIME:RANDOMIZE RND:P=INT(RND*4):IF P=0 THEN P4=1:P3=(INT(RND*11))+2
1900 IF P=1 THEN P3=13:P4=(INT(RND*10))+2
1910 IF P=2 THEN P4=12:P3=(INT(RND*11))+2
1920 IF P=3 THEN P3=1:P4=(INT(RND*10))+2
1930 C$(P3,P4)="F":RETURN:'
1960 ' AVANZAR UNA FASE
1970 LOCATE(x*2)-1,(y*2)-1:PRINT B0$:LOCATE(P3*2)-1,(P4*2)-1:PRINT G0$:ENV 1,5,3,20:SOUND 1,478,0,0,1:FOR E3=1 TO 500:NEXT E3:ERASE C2$,M0$:L1=0:P2=P2+1:WINDOW SWAP 0,2:FOR S=1 TO 25:LOCATE 1,25:PRINT CHR$(10):NEXT:WINDOW SWAP 0,2:CLS#3:GOTO 930
2060 '
2070 ' ABRE COFRE Y GENERA DINERO AL AZAR
2080 B1=INT(RND*99)+1:LOCATE(D3*2)-1,(D4*2)-1:PRINT B1$:C$(D3,D4)="$":GOTO 1450:'
2130 ' COGE EL DINERO
2140 LOCATE(x*2)-1,(y*2)-1:PRINT B0$:LOCATE(D3*2)-1,(D4*2)-1:PRINT G0$:C$(x,y)=".":x=D3:y=D4:FOR E3=1 TO 50:NEXT E3:LOCATE 30,24:PRINT CHR$(15)+CHR$(1);D5;CHR$(15)+CHR$(3);"+";B1:FOR E3=1 TO 1000:NEXT E3:FOR C9=D5 TO(D5+B1)STEP 2:LOCATE 30,24
2210 PRINT CHR$(15)+CHR$(1);C9;CHR$(15)+CHR$(3);"+";B1:SOUND 1,150,1:NEXT C9:D5=D5+B1:LOCATE 30,24:PRINT CHR$(15)+CHR$(1);D5;"    ";:GOTO 1630
2260 '
2270 ' MENU
2271 E0=0:O$(1)="PASS TURN":O$(2)="MOVE":O$(3)="ATTACK":O$(4)="USE":FOR O1=1 TO 4:PAPER 0:PEN 1:LOCATE 32,O1+7:PRINT O$(O1):NEXT O1:LOCATE 30,7:PRINT M$:O1=1
2350 LOCATE 30,O1+6:PRINT M$:LOCATE 32,O1+7:PAPER 2:PEN 0:PRINT O$(O1)
2370 a$=INKEY$:IF a$=""THEN 2370
2380 IF a$=CHR$(240)THEN 2420
2390 IF a$=CHR$(241)THEN 2460
2400 IF a$=" "AND O1=1 THEN 2530
2401 IF a$=" "AND O1=2 THEN 2500
2410 GOTO 2370
2420 IF O1=1 THEN 2370
2430 PAPER 0:LOCATE 30,O1+6:PRINT B0$:PEN 1:PAPER 0:LOCATE 32,O1+7:PRINT O$(O1):O1=O1-1:GOTO 2350
2460 IF O1=4 THEN 2370
2470 PAPER 0:LOCATE 30,O1+6:PRINT B0$:PEN 1:PAPER 0:LOCATE 32,O1+7:PRINT O$(O1):O1=O1+1:GOTO 2350
2500 IF M2=0 THEN 2370 ELSE M2=1
2501 PAPER 1:CLS#3:P1=5:PAPER 0:GOTO 1450
2520 '
2530 ' MOVIMIENTO ENEMIGOS
2531 IF M1=0 THEN 1440
2532 PAPER 0:CLS#3:FOR E0=1 TO E:IF H(E0)<1 THEN 2661
2542 B=0:IF C$(E(E0),E0(E0)-1)<>"."THEN B=B+1
2544 IF C$(E(E0)+1,E0(E0))<>"."THEN B=B+1
2545 IF C$(E(E0),E0(E0)+1)<>"."THEN B=B+1
2546 IF C$(E(E0)-1,E0(E0))<>"."THEN B=B+1
2547 IF B=4 THEN 2661
2548 FOR P0=1 TO 4
2550 RANDOMIZE TIME:C=INT(RND*4)+1:IF C=1 AND C$(E(E0),E0(E0)-1)<>"."THEN 2550
2570 IF C=2 AND C$(E(E0)+1,E0(E0))<>"."THEN 2550
2580 IF C=3 AND C$(E(E0),E0(E0)+1)<>"."THEN 2550
2590 IF C=4 AND C$(E(E0)-1,E0(E0))<>"."THEN 2550
2600 LOCATE(E(E0)*2)-1,(E0(E0)*2)-1:PRINT B0$:C$(E(E0),E0(E0))=".":IF C=1 THEN E0(E0)=E0(E0)-1
2620 IF C=2 THEN E(E0)=E(E0)+1
2630 IF C=3 THEN E0(E0)=E0(E0)+1
2640 IF C=4 THEN E(E0)=E(E0)-1
2650 C$(E(E0),E0(E0))="1":LOCATE(E(E0)*2)-1,(E0(E0)*2)-1:PRINT R$:NEXT P0
2661 NEXT E0:M2=1:GOTO 2270
2680 '
2681 ' ATAQUE JUGADOR
2682 ' CALCULA DAO:
2683 ' 1. a quien estamos atacando?
2684 '
2685 FOR E0=1 TO E:IF D3=E(E0)AND D4=E0(E0)THEN O=E0
2687 NEXT E0:'
2699 ' 2. cuanto dao le hacemos?
2700 '
2750 D=INT(RND*(F/2)):A0=F+D:D=INT(RND*(D(O)/2)):D0=D(O)+D:G=A0-D0:IF A0>D0 THEN GOSUB 4000 ELSE GOSUB 4170
2791 IF H(O)<1 THEN 6000
2830 '
2840 ' CONTRAATAQUE DEL ENEMIGO
2860 D=INT(RND*(F(O)/2)):A0=F(O)+D:D=INT(RND*(D2/2)):D0=D1+D:G=A0-D0:IF A0>D0 THEN GOSUB 4100 ELSE GOSUB 5000
2910 IF H(O)<1 THEN GOSUB 6000 ELSE 2530
4000 ' ANIMACION ATAQUE EXITOSO DEL JUGADOR
4010 LOCATE(D3*2)-1,(D4*2)-1:PRINT G$:ENV 1,11,-1,5:ENT 1,9,49,5,9,-10,15:SOUND 3,145,100,12,1,1,12:FOR E3=1 TO 1000:NEXT E3:LOCATE(D3*2)-1,(D4*2)-1:PRINT R$:H(O)=H(O)-G:RETURN
4100 ' ANIMACION ATAQUE EXITOSO DEL ENEMIGO
4110 LOCATE(x*2)-1,(y*2)-1:PRINT G$:ENV 1,11,-1,5:ENT 1,9,49,5,9,-10,15:SOUND 3,145,100,12,1,1,12:FOR E3=1 TO 1000:NEXT E3:LOCATE(x*2)-1,(y*2)-1:PRINT G0$:LOCATE 33,6:PAPER 0:PEN 3:PRINT G*(-1):H0=H0-G
4151 IF H0<1 THEN LOCATE 33,5:PAPER 0:PEN 1:PRINT" 0  ":GOTO 7000 ELSE 4152
4152 H0$=STR$(H0):H0$=RIGHT$(H0$,LEN(H0$)-1):H$=STR$(H):H$=RIGHT$(H$,LEN(H$)-1):PAPER 0:PEN 1:LOCATE 34,5:PRINT H0$;"/";H$;" ":CLS#3:RETURN
4170 ' ANIMACION ATAQUE FALLIDO DEL JUGADOR
4180 PRINT CHR$(7):RETURN
5000 ' ANIMACION ATAQUE FALLIDO DEL ENEMIGO
5010 PRINT CHR$(7):RETURN
6000 '
6010 ' BORRA ENEMIGO MUERTO Y LIBERA SU CASILLA
6020 LOCATE(D3*2)-1,(D4*2)-1:PRINT B0$:C$(D3,D4)=".":M1=M1-1:'
6060 ' suma experiencia al jugador
6070 FOR C9=1 TO X(O)STEP 2:LOCATE 33,16:PRINT X0+C9:SOUND 1,150,1:NEXT C9:X0=X0+X(O):LOCATE 33,16:PRINT X0:GOTO 2530
7000 '
7010 ' GAME OVER
7020 PAPER 0:CLS:PRINT N$;" HAS BEEN SLAINED BY A ";I$(O):PRINT"IN FLOOR ";P2:PRINT"YOUR MANAGED TO LOOT ";D5;"COINS":PRINT:PRINT"PRESS ANY KEY TO RESTART...":CALL &BB18:RUN
using AMSTRAD TOOLKIT from BEEBUGSOFT
Well, that looks interesting. I assume you can do it with that toolkit thingy. I think I could have the original source for editing it in future updates and release the shortened version. That way it will still be readable to me while you get a lighter and faster version of the game. Am I right?By the way... Do you see a noticeable gain in performance too by shortening the variables?
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 21:49, 26 October 19
Ok, it´s been a couple of days, but that doesn´t mean I´ve been inactive. There was a semi-heavy revamp on the project:
I felt like I was going in a different direction I wanted at the beginning, which is making a roguelike. All that maze-solving algorithms and movement points was driving me crazy, and I realized I was trying to make a tactical game, not a roguelike, so...

I decided to reorganize the code. At that point it was all getting really messy, with an unreadable codeflow, so I packed all the main sub-routines individually so they could be invoked in an organized and controlled way, just leaving a control group of GOSUBs at the beginning callign all the functions. Incredibly good decision! Just by doing this, the code looks now like something closer to a game engine than a straight program, which makes my life way easier. It´s now very modular and editable. Really sweet to work with it.
In the other hand, I changed to a pure roguelike turn system (one step each monster and player). Also added a dotted floor, like it should be (classic roguelike stuff)Right now I´m starting to documentate the combat system (that will be more deep and complex than before) based in the Warhammer Fantasy Rule Book... lots of awesome premade creatures to choose from!
So, I think there will be no updates this weekend, but the projects is alive and kicking. Expect to have cool updates in the near future with more creatures, enhanced combat system, roguelike system and much more... btw, do you guys like my skeleton design? :P
(https://i.postimg.cc/Qd6q7zjG/skeleton.jpg) (https://postimages.org/)
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 23:09, 27 October 19
New update! I´m so thrilled about the new direction that I pushed hard this evening to have something workable.I´m grabbing monsters, weapons, etc... from Warhammer Fantasy RPG, so now you have the rat and a new monster, which is the skeleton.The rat is really weak, too weak to harm you, so feel free to stab them at will.Beware the skeletons! They can hurt you badly, but don´t worry about that because by now, the character is using only a hand weapon and no armor or shield.The enemies are static. I will code their movement during the week. Time to sleep now.
Updated SDK and changelog in the first post.
Title: Re: My roguelike in BASIC
Post by: OBsd74 on 20:10, 28 October 19
Hello.
I wanted to test your roguelike, but since october 17th update or so, every single I try to run it whatever emulator I use, I got a "Direct command found" error.
I tried: javacpc, caprice32, Arnold and CPCBox (https://www.retrovm.com/) without any luck :(
Any idea about what is going on? Thanks!
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 20:51, 28 October 19
Quote from: OBsd74 on 20:10, 28 October 19
Hello.
I wanted to test your roguelike, but since october 17th update or so, every single I try to run it whatever emulator I use, I got a "Direct command found" error.
I tried: javacpc, caprice32, Arnold and CPCBox (https://www.retrovm.com/ (https://www.retrovm.com/)) without any luck :(
Any idea about what is going on? Thanks!
It happens to me too. I guess it's related to the interpretation of the machine. If you get that error, just type RUN again and it will work.
Title: Re: My roguelike in BASIC
Post by: robcfg on 21:20, 28 October 19
Please try something.


Just remove any 'ñ' character from your code, as I suspect it´s not properly translated and may cause the error when loading.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 21:32, 28 October 19
Mmm... That will be weird, since my emulator is in Spanish and it contains that letter. But I'll try anyways.
Title: Re: My roguelike in BASIC
Post by: robcfg on 21:55, 28 October 19
Yes, but that doesn't mean that the ñ character is coded with the same value or that the value has the same meaning on the CPC.


I deleted rem lines 7123 and 7255 and saved it to disk, and now runs without problem.


If you list those lines you'll see two weird characters instead of the single ñ character.


Edit: On the ASCII table ñ and Ñ are characters 164 and 165 while on the CPC they are 171 and 161. Thus, if you save a 164, the CPC will show the copyright symbol instead of ñ.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 22:33, 28 October 19
Quote from: robcfg on 21:55, 28 October 19
Yes, but that doesn't mean that the ñ character is coded with the same value or that the value has the same meaning on the CPC.


I deleted rem lines 7123 and 7255 and saved it to disk, and now runs without problem.


If you list those lines you'll see two weird characters instead of the single ñ character.


Edit: On the ASCII table ñ and Ñ are characters 164 and 165 while on the CPC they are 171 and 161. Thus, if you save a 164, the CPC will show the copyright symbol instead of ñ.
I just tried editing then code replacing "ñ" with "n" from outside of the emulator (in sublime) then saving it, loading in the emulator and it still throws the "direct command found" error. So, the "ñ" theory doesn´t seem to be the problem.
The "direct command found" error indicates a non-numbered line in the ascii before converting it into a workable program by the CPC. Which is weird since I don´t have any non-numbered lines in my code.
Try this:
1. run the program from the disk
2. You´ll get the error
3. Do nothing and from then emulator itself, save the program again
4. Run the program again from the disk, you´ll get no error

There´s something with the emulator. I get a "Direct command found" most of the times (not everytime). Other times I get an "overflow" error, that gets fixed by deleting the first line of the program. Other times, the emulator replaces some random line with a random piece of other part of the code,etc... something happens in the import or the export of the ascii file.
Title: Re: My roguelike in BASIC
Post by: Fessor on 23:46, 28 October 19
There are a bunch of empty lines in your Code...
You can see them with this little program (it simply reads the ascii-file line for line and prints it)

10 openin "<FILENAME>"
20 while not eof
30 line input #9,a$:print a$
40 wend
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 00:11, 29 October 19
Quote from: Fessor on 23:46, 28 October 19
There are a bunch of empty lines in your Code...
You can see them with this little program (it simply reads the ascii-file line for line and prints it)

10 openin "<FILENAME>"
20 while not eof
30 line input #9,a$:print a$
40 wend

Empty lines are empty strings. "Direct command found" means a BASIC command without a line number assigned. Anyways, I could check if removing the empty lines solves the problem. But for the code to be readable by the CPC it needs to have an empty line at the very end, so... XD

Anyways, don´t worry about that. If you get the error, just type RUN again and it will work. By the time of releasing the first full version I will make sure to re-save the program from the emulator, so it doesn´t give that problem.
Title: Re: My roguelike in BASIC
Post by: OBsd74 on 08:49, 29 October 19
Quote from: PAQUITO on 20:51, 28 October 19
It happens to me too. I guess it's related to the interpretation of the machine. If you get that error, just type RUN again and it will work.
Will try it and hope it will run this time. But seeing this bug in 4 emulators make me angry :(

Tried with prueba4.bas. File lost 1 kb. Instead of being 14Kb long, it is only 13kb long now. For prueba3, it went from 17 to 16 Kb.

Something is wrong with your export :(

Using this trick and your roguelike is running. At least :)
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 12:56, 29 October 19
Quote from: asertus on 15:16, 10 October 19
Actually, when it is done I'd try to embed 8bp library. You'd get an amazing game with it.
I had a look at some 8bp stuff. I was wondering if I could be implementing it in my game gradually. For example: Printing the dungeon is now quite slow. Could I have a call in your library that speeds up  that proccess?
Title: Re: My roguelike in BASIC
Post by: asertus on 13:13, 29 October 19
Quote from: PAQUITO on 12:56, 29 October 19
I had a look at some 8bp stuff. I was wondering if I could be implementing it in my game gradually. For example: Printing the dungeon is now quite slow. Could I have a call in your library that speeds up  that proccess?

As you speak Spanish, in latest 8BP documentation, 

https://github.com/jjaranda13/8BP/tree/master/Documentacion (https://github.com/jjaranda13/8BP/tree/master/Documentacion)

you can use 8BP:  |LAYOUT, y, x, @string$
command for that. Take a look at the documentation. Chapter 8: 8 Juegos de pantallas: layout o "tile map"

It draws the layout, lets you detect collissions, etc... Moreover in the frogger tutorial there is a good example about how to use it.
Title: Re: My roguelike in BASIC
Post by: SRS on 16:43, 29 October 19
Quote from: asertus on 13:13, 29 October 19
As you speak Spanish, in latest 8BP documentation, 

https://github.com/jjaranda13/8BP/tree/master/Documentacion (https://github.com/jjaranda13/8BP/tree/master/Documentacion)

you can use 8BP:  |LAYOUT, y, x, @string$
command for that. Take a look at the documentation. Chapter 8: 8 Juegos de pantallas: layout o "tile map"

It draws the layout, lets you detect collissions, etc... Moreover in the frogger tutorial there is a good example about how to use it.


Isn't 8BP MODE 0 and the game is MODE 1 ? Just to consider ...
Maybe you can transform your chars to sprites with ESD2 and use them .. playing around a bit ... a loader to build and grab sprites, save them binary, and load the data and so on

10 ' ESD ADVANCED from THE BASIC IDEA
20 ' By Sean McManus - www.sean.co.uk
30 '
40 MODE 1:PRINT"Installing Machine Code...."
50 'Fine Force routine - September 1993 Sean McManus
60 RESTORE 60:FOR mem=40000 TO 40052
70 READ a$:a=VAL(("&")+a$)
80 POKE mem,a:NEXT
90 DATA DD,6E,0,DD,66,1,DD,5E,2,DD,56,3,CD,1D,BC,E5,DD,5E,4,DD,56,5,EB,4E,23,46,23,EB,E1,C5,E5,1A,77,23,13,10,FA,E1,1,0
100 DATA 8,9,30,4,1,50,C0,9,C1,D,20,E9,C9
110 '****** ENDS ******
260 'Fine Grab routine - September 1993
270 RESTORE 270:FOR mem=40164 TO 40221
280 READ a$:a=VAL(("&")+a$)
290 POKE mem,a:NEXT
300 DATA DD,6E,4,DD,66,5,DD,5E,6,DD,56,7,CD,1D,BC,EB,DD,6E,8,DD,66,9,DD,4E,0,DD,46,2,71,23,70,23,C5,D5,1A,77,23,13,10,FA
310 DATA D1,EB,1,0,8,9,30,4,1,50,C0,9,EB,C1,D,20,E7,C9
400 GOSUB 8150
410 MODE 1
415 CLS:PRINT borr$:CALL 40164,30000,0,199,4,16
420 CLS:PRINT muro$:CALL 40164,30000+(4*16+2),0,199,4,16
430 FOR x=0 TO 319 step 16:for y=15 to 199 step 16
435 CALL 40000,30000,x,y:NEXT y,x
440 FOR x=0 TO 319 step 16:for y=15 to 199 step 16
450 CALL 40000,30066,x,y:NEXT y,x:goto 430
499 END
8140 '
8150 ' DEFINE GRAFICOS
8151 '
8160 SYMBOL AFTER 216
8401 ' GRAFICOS
8410 SYMBOL 216,6,54,72,21,50,72,144,0
8411 SYMBOL 217,32,103,111,107,105,103,101,104
8412 SYMBOL 218,0,192,224,160,32,192,64,28
8413 SYMBOL 219,247,9,103,1,7,12,8,56
8414 SYMBOL 220,190,127,127,127,190,220,64,224
8420 SYMBOL 221,60,126,175,211,165,243,118,60
8430 SYMBOL 222,126,118,98,118,118,60,24,0
8440 SYMBOL 223,24,44,70,255,70,44,24,0
8450 SYMBOL 224,0,6,14,220,120,48,88,136
8460 SYMBOL 225,16,4,0,8,77,3,231,255
8470 SYMBOL 226,0,140,204,208,224,232,252,224
8480 SYMBOL 227,63,15,103,111,13,24,0,4
8490 SYMBOL 228,242,254,252,224,224,244,224,0
8500 SYMBOL 229,0,0,28,29,15,151,127,4
8510 SYMBOL 230,1,1,226,244,248,248,248,40
8520 SYMBOL 231,0,0,0,0,0,0,195,239
8530 SYMBOL 232,0,0,0,0,48,240,224,192
8540 SYMBOL 233,223,239,223,239,223,227,192,0
8550 SYMBOL 234,255,255,232,232,208,160,0,0
8560 SYMBOL 235,1,7,14,28,58,60,62,28
8570 SYMBOL 236,224,216,220,108,240,120,184,112
8580 SYMBOL 237,0,254,252,248,240,248,252,254
8590 SYMBOL 238,0,127,63,31,15,31,63,127
8600 SYMBOL 239,0,255,255,255,255,255,255,255
8610 SYMBOL 240,1,35,119,119,113,116,115,114
8620 SYMBOL 241,0,128,192,192,192,128,63,187
8630 SYMBOL 242,249,6,119,15,15,15,60,30
8640 SYMBOL 243,49,187,59,187,191,222,236,112
8650 SYMBOL 244,85,254,255,254,255,254,255,254
8660 SYMBOL 245,85,255,255,255,255,255,255,255
8670 SYMBOL 246,253,170,127,255,255,255,255,127
8680 SYMBOL 247,127,170,255,255,255,255,255,254
8690 SYMBOL 248,83,238,217,181,181,109,125,109
8700 SYMBOL 249,193,113,153,172,172,182,190,182
8710 SYMBOL 250,121,102,118,105,125,109,125,109
8720 SYMBOL 251,190,182,190,182,190,182,190,182
8730 SYMBOL 252,31,55,59,0,59,59,59,59
8740 SYMBOL 253,248,252,204,0,204,252,252,252
8750 SYMBOL 254,0,0,6,73,249,6,0,0
8760 SYMBOL 255,&X1
8770 '
8780 ' DEFINE VARIABLES DE LOS SPRITES
8790 ret$=STRING$(2,8)+CHR$(10)
8800 borr$=CHR$(15)+CHR$(1)+"  "+ret$+" "+CHR$(255)
8810 guerr$=CHR$(15)+CHR$(1)+CHR$(240)+CHR$(241)+STRING$(2,8)+CHR$(10)+CHR$(242)+CHR$(243)
8820 muro$=CHR$(15)+CHR$(1)+CHR$(244)+CHR$(245)+STRING$(2,8)+CHR$(10)+CHR$(246)+CHR$(247)
8830 puerta$=CHR$(15)+CHR$(2)+CHR$(248)+CHR$(249)+ret$+CHR$(250)+CHR$(251)
8840 cofre$=CHR$(15)+CHR$(1)+"  "+ret$+CHR$(252)+CHR$(253)
8850 llave$=CHR$(15)+CHR$(2)+"  "+ret$+" "+CHR$(254)
8860 cintai$=CHR$(15)+CHR$(3)+CHR$(238)+CHR$(239)
8870 cintad$=CHR$(15)+CHR$(3)+CHR$(239)+CHR$(237)
8880 botin$=CHR$(15)+CHR$(1)+"  "+ret$+CHR$(235)+CHR$(236)
8890 mano$=CHR$(15)+CHR$(2)+CHR$(231)+CHR$(232)+ret$+CHR$(233)+CHR$(234)
9000 golpe$=CHR$(15)+CHR$(3)+CHR$(225)+CHR$(226)+ret$+CHR$(227)+CHR$(228)
9010 xp$=CHR$(15)+CHR$(3)+"  "+ret$+" "+CHR$(221)
9020 escudo$=CHR$(15)+CHR$(2)+"  "+ret$+" "+CHR$(222)
9030 arco$=CHR$(15)+CHR$(3)+"  "+ret$+" "+CHR$(223)
9040 espada$=CHR$(15)+CHR$(2)+"  "+ret$+" "+CHR$(224)
9041 agilidad$=CHR$(15)+CHR$(2)+"  "+ret$+" "+CHR$(216)
9050 RETURN
Title: Re: My roguelike in BASIC
Post by: asertus on 15:18, 30 October 19
Quote from: SRS on 16:43, 29 October 19
Isn't 8BP MODE 0 and the game is MODE 1 ? Just to consider ...


Since version 34 it has some support for Mode 1 too, 40x25, with some limitations.



Title: Re: My roguelike in BASIC
Post by: PAQUITO on 19:41, 31 October 19
Let´s keep pushing! :)
(https://i.postimg.cc/SKPLB9fk/sheet.jpg) (https://postimages.org/)
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 01:58, 01 November 19
Ok, another update:
We can now finally move in turns and the combat system and attributes has been refined a lot. Sadly, I saw no rats in the Warhammer bestiary, but I assigned it the values of a Snotling. The skeleton remains a skeleton. This way we have two levels of enemies to make some test gameplays. The snotling (which you see as a rat) is labeled in the rulebook as "easy". The skeleton is labeled as "routine".
Please grab the updated SDK in the first post and throw some feedback.Have a nice halloween everyone! :)
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 22:50, 01 November 19
I´m particullary interested in your opinion about moving in diagonals.
Do you like it or do you prefer moving just in 4 directions?
Title: Re: My roguelike in BASIC
Post by: genesis8 on 15:04, 03 November 19
Quote from: PAQUITO on 22:50, 01 November 19
I´m particullary interested in your opinion about moving in diagonals.
Do you like it or do you prefer moving just in 4 directions?


It would be better and feel more roguelike with diagonals.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 14:53, 10 November 19
Ok, new update!
I´ve been in the verge of throwing my computer out the window because of a bug where an enemy resurrected for no apparent reason, and only sometimes. It really broke my peace of mind, bu finally I ended up locating the problem in the code and it´s fixed! :)
So, in this release I implemented critical hits (5% chance of doubling the damage in each attack), leveling up of the character (right now you level up after each stage, but I must set up an experience points goal to reach for this to happen in next updates). Also, there is a little "push" animation in each attack, both por player and enemies.
Download link in the first post.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 22:15, 17 November 19
No updates this weekend, guys.I´m really busy with my new website and another stuff. But for now, I´m using this sunday night for copying the Ghosts N Goblins font with the all-powerful Art Studio :)(https://i.postimg.cc/Xq413GVB/artstudio.jpg) (https://postimages.org/)
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 22:46, 17 November 19
By the way... How can I use my mouse?
I have created an AMX mouse, but it doesn´t seem to work. What am I supposed to do?
Title: Re: My roguelike in BASIC
Post by: VincentGR on 22:48, 17 November 19
Technically nothing, it acts like a joystick.
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 23:21, 17 November 19
One more thing: How do I load the font file? (*.fnt)I remember loading it using some HIMEM expression... but how exactly was it?
Title: Re: My roguelike in BASIC
Post by: Fessor on 01:14, 18 November 19
Its one of the older Threads here ;)
http://www.cpcwiki.eu/forum/programming/modify-the-font-appearance/
Title: Re: My roguelike in BASIC
Post by: PAQUITO on 18:54, 24 November 19
I´m happy! :)
I spent this sunday evening coding a new type of enemy. It´s a "chaser/shooter". Another skeleton, but with bow and arrows. He will chase you until finding a clear shooting line. If there is a chance for him to shoot, he will, otherwise he will just stand still until getting a clear line (or will continue chasing you if you get out from his shooting line).So... a really funny exercise that makes me feel really proud of my coding. May sound silly, but I feel it like that lol.
Find the download link in the first post.
Powered by SMFPacks Menu Editor Mod