Minilop Retroware

Tutoriales de shoot 'em up · Parte 10 de 12

Shmup vertical - Parte 10 - Un poco de orden

2 de agosto de 2022

Ahora que tenemos funcionando la mayor parte de lo básico del juego, hagamos una pausa y pulamos un poco la presentación.

Primero añadamos un menú de intro:

MENÚ: EVENTS > INTRO MENU

EVENT INTROMENU

WAITKEY
BORDER 0                    ; black border
COLOUR 68                   ; green text on black
CLS                         ; clear the screen   
LET CONTROL = 99
WHILE CONTROL >= 99
	PRINTMODE 1
	AT 4 7
	PRINT "RETURN TO ARCADIA"
	PRINTMODE 0
    AT 8 10
    PRINT "1. KEYBOARD"
    AT 10 10
    PRINT "2. KEMPSTON"
    AT 12 10
    PRINT "3. SINCLAIR"
    AT 14 10
    PRINT "4. REDEFINE"
    LET CONTROL = 99
    WHILE CONTROL = 99
        IF KEY OPTION1
            LET CONTROL = 0
        ENDIF
        IF KEY OPTION2
            LET CONTROL = 1
        ENDIF
        IF KEY OPTION3
            LET CONTROL = 2
        ENDIF
        IF KEY OPTION4
		CLS
		WHILE KEY OPTION4
        ENDWHILE
        AT 7 12
		PRINT "PRESS KEY FOR:"
		AT 9 12
		PRINT "LEFT"     
		DEFINEKEY LEFT	; the key pressed will be the new LEFT key
		AT 11 12        
		PRINT "RIGHT"     
		DEFINEKEY RIGHT	; the key pressed will be the new RIGHT key
		AT 13 12
		PRINT "THRUST"
		DEFINEKEY UP		; the key pressed will be the new THRUST key
		AT 15 12
		PRINT "FIRE"
		DEFINEKEY FIRE1	; the key pressed will be the new FIRE key
		AT 17 12
		PRINT "PAUSE"
		DEFINEKEY FIRE3	; this will be the PAUSE key
		LET CONTROL = 100 
		CLS
        ENDIF
    ENDWHILE
ENDWHILE
CLS

A continuación, ordenaremos el evento Game Initialisation:

MENÚ: EVENTS > Game Initialisation:

EVENT GAMEINIT

LET L = 1			; Level (starts at 1)

LET LIVES = 3	
AT 0 14
DISPLAY LIVES

AT 0 1
SHOWSCORE

AT 0 25
SHOWHIGH

Ahora añadamos un mensaje “Get Ready” en pantalla cada vez que el jugador empiece (incluso después de que lo maten, si aún le quedan vidas):

EVENT RESTARTSCREEN

LET S = 0			; initialise the sprite counter
AT 0 1				; position the cursor Line 0 Column 1
SHOWSCORE			; display the score

AT 10 12			     ; Cursor at L10 C2
REPEAT 10			; do this 10 times
READ A				; read next item into A
CHR A				; Display A
DELAY 5				; short wait
ENDREPEAT			; all items displayed?
DELAY 100			; longer wait


DATA 'G' 'E' 'T' ' ' 'R' 'E' 'A' 'D' 'Y' '!'



Después, el evento Kill Player:

MENÚ: EVENTS > KILL PLAYER

EVENT KILLPLAYER

SUBTRACT 1 FROM LIVES	; reduce number of lives remaining
AT 0 16					; update the lives in the score bar
DISPLAY LIVES
CLW						; clear the play area

Y por último, por ahora, el evento Lost Game:

MENÚ: EVENTS > LOST GAME

EVENT LOSTGAME


AT 10 12			    ; Cursor at L10 C2
REPEAT 10			; do this 10 times
READ A				; read next item into A
CHR A				; Display A
DELAY 5				; short wait
ENDREPEAT			; all items displayed?
DELAY 100			; longer wait


DATA 'G' 'A' 'M' 'E' ' ' 'O' 'V' 'E' 'R' '!'

Y para darle un toque visual extra, añadiremos un campo de estrellas al área de juego. Añade esta línea a tu evento Main Loop 1:

STAR DOWN		; vertical star field

También voy a elegir una fuente nueva.

Ahora probémoslo:

Y ahí lo tienes. Si has llegado hasta aquí, deberías tener un shoot 'em up vertical pequeño pero totalmente funcional. Mi versión usa ahora mismo algo menos de 13Kb de memoria, así que nos queda mucho con lo que jugar. En algún momento querremos añadir sonido, quizá algunos potenciadores, pero lo siguiente que quiero es mejorar el sprite del alienígena para que apunte en la dirección en la que se desplaza.

Todos los tutoriales de shoot 'em up