El misil del jugador se define en Sprite Type 1. Usa una imagen de sprite sencilla de 16x16 y se lanza cuando el jugador pulsa la tecla de disparo.
Por defecto, el misil solo recorre la mitad de la altura de la pantalla, pero puedes editarlo fácilmente, o usar una de las variables disponibles para definirlo, lo que podría ser una forma ingeniosa de recompensar al jugador con una mejora.
Cuando alcanza su distancia máxima, o llega a la parte superior de la pantalla, o golpea a un enemigo, provoca una explosión incrementando el frame, ya que la explosión del torpedo está contenida en los frames 1-4
EVENT SPRITETYPE1 ;======= PLAYER TORPEDOS ============ ;============================================ ; ; VARIABLES ; ======================================================= ; DIRECTION - DIRECTION OF TRAVEL, 99 = TRIGGER EXPLOSION ; SETTINGA - availabe for use in your game ; SETTINGB - DISTANCE TRAVELLED COUNTER ; AIRBORNE - availabe for use in your game ; JUMPSPEED - availabe for use in your game ; ======================================================== IF DIRECTION 1 ; Torpedo travel up LET IMAGE = 1 ; make sure we are on image 1 REPEAT 6 ; torpedos move quick, so do this 6 times SPRITEUP ; move up ADD 2 TO SETTINGB ; increase the distance travelled by 2 IF SETTINGB > = 88 ; when distance travelled = 88 LET DIRECTION = 99 ; run the explode routine ENDIF IF Y <= 8 ; has the torpedo reached the top? LET DIRECTION = 99 ; yes, so explode it EXIT ; exit this event (as we are in a loop) ENDIF ENDREPEAT ENDIF ; EXPLODE THE TORPEDO ; =================== IF DIRECTION = 99 ; torpedo explosion requested ADD 1 TO FRAME ; increment the frame IF FRAME = 5 ; when we reach the last frame REMOVE ; remove the torpedo SUBTRACT 1 FROM S ; decrement the sprite counter ENDIF ENDIF
