Author Topic: My roguelike in BASIC  (Read 3166 times)

0 Members and 1 Guest are viewing this topic.

Offline PAQUITO

  • CPC464
  • **
  • Posts: 42
  • Country: es
  • Liked: 57
  • Likes Given: 7
My roguelike in BASIC
« on: 13: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.

LATEST VERSION
  • Added a 5% chance of critical hit in each attack with its own different effect.
  • Added animation of attacks for every actor.
  • Level Up system (to be refined)
  • Fixed the "resurrecting enemies" bug
This is the base game. I will be updating it by adding more features, monsters, chests, combat system, etc...last update: Sunday, november 11stCPC6128 version (DSK): http://bit.ly/2K76A5I
« Last Edit: 15:52, 10 November 19 by PAQUITO »

Offline XeNoMoRPH

  • 6128 Plus
  • ******
  • Posts: 521
  • Country: es
  • " ... in space no one , can hear you scream ... "
  • Liked: 1040
  • Likes Given: 912
Re: My roguelike in BASIC
« Reply #1 on: 15:13, 03 October 19 »
Welcome !!!  8)

Offline SpDizzy

  • CPC464
  • **
  • Posts: 37
  • Country: es
  • Liked: 17
  • Likes Given: 22
Re: My roguelike in BASIC
« Reply #2 on: 20:23, 03 October 19 »
Really welcome!!Nice to see some roguelike basic projects, maybe inspired on the series #AmstradGameDevChallenge 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.

Offline PAQUITO

  • CPC464
  • **
  • Posts: 42
  • Country: es
  • Liked: 57
  • Likes Given: 7
Re: My roguelike in BASIC
« Reply #3 on: 20: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)

Offline SpDizzy

  • CPC464
  • **
  • Posts: 37
  • Country: es
  • Liked: 17
  • Likes Given: 22
Re: My roguelike in BASIC
« Reply #4 on: 21: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!!


Offline SRS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 559
  • Country: de
  • Schneider CPC464 - what else ?
  • Liked: 546
  • Likes Given: 286
Re: My roguelike in BASIC
« Reply #5 on: 22:05, 03 October 19 »
Nice one.
Could you try to keep it BASIC 1.0 compatible so us 464ers can play it, too ?
Code: [Select]
CLEAR INPUT could be
Code: [Select]
while inkey$<>"":wend i.e.

Offline PAQUITO

  • CPC464
  • **
  • Posts: 42
  • Country: es
  • Liked: 57
  • Likes Given: 7
Re: My roguelike in BASIC
« Reply #6 on: 23:51, 03 October 19 »
Nice one.
Could you try to keep it BASIC 1.0 compatible so us 464ers can play it, too ?
Code: [Select]
CLEAR INPUT could be
Code: [Select]
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?

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.710
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 950
  • Likes Given: 1664
Re: My roguelike in BASIC
« Reply #7 on: 14: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:


Code: [Select]
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.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline VincentGR

  • 6128 Plus
  • ******
  • Posts: 1.106
  • Country: gr
    • Parts from the past.
  • Liked: 582
  • Likes Given: 1570
Re: My roguelike in BASIC
« Reply #8 on: 16:48, 04 October 19 »
lovely!

Offline PAQUITO

  • CPC464
  • **
  • Posts: 42
  • Country: es
  • Liked: 57
  • Likes Given: 7
Re: My roguelike in BASIC
« Reply #9 on: 16:57, 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:


Code: [Select]
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.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.710
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 950
  • Likes Given: 1664
Re: My roguelike in BASIC
« Reply #10 on: 00:58, 05 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)


Code: [Select]

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
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline PAQUITO

  • CPC464
  • **
  • Posts: 42
  • Country: es
  • Liked: 57
  • Likes Given: 7
Re: My roguelike in BASIC
« Reply #11 on: 01:44, 05 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)


Code: [Select]

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 :)

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.710
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 950
  • Likes Given: 1664
Re: My roguelike in BASIC
« Reply #12 on: 03: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. :)
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline PAQUITO

  • CPC464
  • **
  • Posts: 42
  • Country: es
  • Liked: 57
  • Likes Given: 7
Re: My roguelike in BASIC
« Reply #13 on: 03:39, 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.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.710
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 950
  • Likes Given: 1664
Re: My roguelike in BASIC
« Reply #14 on: 11:16, 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


Code: [Select]

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 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 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. 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.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline XeNoMoRPH

  • 6128 Plus
  • ******
  • Posts: 521
  • Country: es
  • " ... in space no one , can hear you scream ... "
  • Liked: 1040
  • Likes Given: 912
Re: My roguelike in BASIC
« Reply #15 on: 14:13, 05 October 19 »

Offline PAQUITO

  • CPC464
  • **
  • Posts: 42
  • Country: es
  • Liked: 57
  • Likes Given: 7
Re: My roguelike in BASIC
« Reply #16 on: 16:13, 05 October 19 »

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


Code: [Select]

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 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 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. 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)

Offline PAQUITO

  • CPC464
  • **
  • Posts: 42
  • Country: es
  • Liked: 57
  • Likes Given: 7
Re: My roguelike in BASIC
« Reply #17 on: 16:15, 05 October 19 »

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.

Offline VincentGR

  • 6128 Plus
  • ******
  • Posts: 1.106
  • Country: gr
    • Parts from the past.
  • Liked: 582
  • Likes Given: 1570
Re: My roguelike in BASIC
« Reply #18 on: 18:02, 05 October 19 »
I use notepad++
Sometimes the windows version does mistakes.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.710
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 950
  • Likes Given: 1664
Re: My roguelike in BASIC
« Reply #19 on: 23:45, 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.  :)


Quote
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)


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.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline PAQUITO

  • CPC464
  • **
  • Posts: 42
  • Country: es
  • Liked: 57
  • Likes Given: 7
Re: My roguelike in BASIC
« Reply #20 on: 00:05, 06 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.

Online mr_lou

  • 6128 Plus
  • ******
  • Posts: 2.903
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1081
  • Likes Given: 2285
Re: My roguelike in BASIC
« Reply #21 on: 09: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?

Offline PAQUITO

  • CPC464
  • **
  • Posts: 42
  • Country: es
  • Liked: 57
  • Likes Given: 7
Re: My roguelike in BASIC
« Reply #22 on: 16:55, 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?

Offline PAQUITO

  • CPC464
  • **
  • Posts: 42
  • Country: es
  • Liked: 57
  • Likes Given: 7
Re: My roguelike in BASIC
« Reply #23 on: 18: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.


Online mr_lou

  • 6128 Plus
  • ******
  • Posts: 2.903
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1081
  • Likes Given: 2285
Re: My roguelike in BASIC
« Reply #24 on: 02:38, 07 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.