alien-b-t

Descripción del contenido de esta página

Programa herramienta escrito en Beta BASIC para crear gráficos necesarios para el juego Alien-B.

Este programa herramienta, escrito en Beta BASIC, crea, a partir de una imagen, los ficheros con las diferentes partes del gráfico del trípode extraterrestre que forma parte del efecto final del juego Alien-B.

Pantallazo

Gráfico completo

Listado


  10 REM alien-b-t
  20 REM This tool program creates, in the current +D disk, from a ZX Spectrum screen, all graphics needed by the program Alien-B (programandala.net/es.programa.alien-b) to show a raising tripod-like alien.
     
  30 REM Copyright (C) 2010 Marcos Cruz (programandala.net)
  40 REM License/Licencia/Permesilo
      programandala.net/pl
     
  50 
     REM ## Change log
     
  60 REM 2010-11-30 First version.
  70 REM 2010-12-02 Improved.
  80 REM 2010-12-06 Improved. The proc getScans can be used for any row. The proc getGraph doesn't get the rows any more; the proc getRows is independent now.
  90 
     REM ## Init
     
 100 POKE @0,7
     REM make sure border changes during disk operations
 110 RANDOMIZE USR 58419
     REM Beta BASIC must be turned on after the DOS command
 120 DEF PROC init
 130   LET x=0,y=175
       REM coords of the graphic in the original screen
 140   LET width=11,height=15
       REM size of the graphic in characters
 150   LET f$="tripod"
       REM base file name
 160   LET s$="BC"
       REM file name sufixes (first char for bitmaps without color attributes, second char for bitmaps with color attributes)
 170 END PROC 
     
 180 
     REM ## Main
     
 190 CLS #
 200 init
 210 LOAD d*;f$SCREEN$ 
     ALTER TO PAPER 0, INK 7
     REM screen that holds the original graphic
 220 getRows 1
     REM all rows, with color
 230 getScans 0
     REM scans of the first row
 240 getScans height-1
     REM scans of the last row
 250 STOP 
     
 260 DEF PROC getGraph type
 270   LOCAL r,t$,x$
 280   GET x$,x,y,width,height;type
       DIM t$(LEN x$)
       LET t$()=x$
       SAVE d*;f$+s$(type+1) DATA t$()
 290 END PROC 
     
 300 DEF PROC getRows type
 310   LOCAL r,t$,x$
 320   FOR r=0 TO height-1 
 330     GET x$,x,y-r*8,width,1;type
         DIM t$(LEN x$)
         LET t$()=x$
         SAVE d*;f$+s$(type+1)+USING$("00",r) DATA t$()
 340   NEXT r
 350 END PROC 
     
 360 DEF PROC getScans row
 370   LOCAL s,scans,screenAddr
       LET scans=8,screenAddr=16384
 380   CLS #
       LOAD d*;f$+s$(2)+USING$("00",row) DATA x$()
       PLOT x,y;x$
       REM show the last row of the graphic
 390   FOR s=0 TO scans-1
 400     SAVE d*;f$+s$(1)+USING$("00",row)+STR$ sCODE screenAddr,width
         REM get the scan and save it apart
 410     SCROLL 7,1;x,y;width,scans
         REM next scan up
 420   NEXT s
 430 END PROC 
     
 440 
     REM ## Test
     
 450 DEF PROC test type
 460   LOCAL l,z$
 470   CLS #
 480   LOAD d*;f$+s$(type+1) DATA z$()
       PLOT x,y;z$
 490   FOR l=height-1 TO 0 STEP -1
 500     LOAD d*;f$+s$(type+1)+USING$("00",l) DATA z$()
         PLOT x+width*8,y-8*l;z$
 510   NEXT l
 520 END PROC 
     
 530 
     REM ## Tools
     
 540 DEF PROC getScreen
 550   CLS #
 560   PRINT "1) Load the SCR screenshot file"'"using your emulator."''"2) Press any key; the screen"'"will be saved on the disk with"'"the name '";f$;"'
       ." 
 570   PAUSE 0
       SAVE d*;f$SCREEN$ 
 580 END PROC 
     
 590 DEF PROC eraseFiles
 600   LOCAL n
 610   CLS #
       PRINT "Erasing graphic files..."
 620   FOR n=1 TO LEN s$
         LET n$=f$+s$(n)+"*"
         PRINT n$
         ERASE d*;n$
       NEXT n
 630   PRINT "Done."
 640 END PROC 
     
 650 
     REM ## Meta
     
 660 DEF PROC s
 670   ERASE d*"alien-b-t~"
 680   ERASE d*"alien-b-t" TO "alien-b-t~"
 690   CLEAR 
       SAVE d*"alien-b-t"
       STOP 
 700 END PROC 

Descarga

Este programa está en el disco de Alien-B.

Páginas relacionadas

Glosario

BASIC
Beginner's All-Purpose Symbolic Instruction Code (código polivalente de instrucciones simbólicas para principiantes)
GDU
Gráfico Definido por el Usuario