Minilop Retroware

Tutoriais de shoot 'em up · Parte 10 de 12

Shmup vertical - Parte 10 - Um pouco de arrumação

2 de agosto de 2022

Agora que temos a maior parte do básico do jogo a funcionar, vamos fazer uma pausa e arrumar um pouco a apresentação do jogo.

Primeiro vamos acrescentar um menu de intro:

MENU: 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 seguir, vamos arrumar o evento Game Initialisation:

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

Agora vamos acrescentar uma mensagem “Get Ready” no ecrã sempre que o jogador começar (incluindo depois de ser morto, se ainda tiver 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' '!'



Depois, o evento Kill Player:

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

E por fim, por agora, o evento Lost Game:

MENU: 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' '!'

E para dar um toque visual extra, vamos acrescentar um campo de estrelas à área de jogo. Acrescenta esta linha ao teu evento Main Loop 1:

STAR DOWN		; vertical star field

Também vou escolher um novo tipo de letra.

Agora vamos testar:

E pronto. Se chegaste até aqui, deves ter um shoot 'em up vertical pequeno, mas totalmente funcional. A minha versão está neste momento a usar um pouco menos de 13Kb de memória, por isso ainda temos muito com que brincar. Em algum momento vamos querer acrescentar som, talvez alguns potenciadores, mas a seguir quero melhorar o sprite do alienígena para que aponte na direção em que se desloca.

Todos os tutoriais de shoot 'em up