top of page
Writer's pictureBruce

Player Missile Event - Shmupkit

The player Missile is defined in Spite Type 1. It uses a simple 16x16 sprite image, and is launched when the player presses the fire key.


As standard, the missile will only travel half the height of the screen ,but you easily edit this, or use one of the available variables for defining it, which might be a neat way of rewarding the player with a power up.


When it reaches its maximum distance, or reaches the top of the screen, or hits an enemy, it triggers an explosion, by incrementing the frame - since the torpedo explosion is contained in 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



46 views0 comments

Recent Posts

See All

Variables Reference - Shmupkit

Here's a full list of the Global Variables used by Shmupkit, I've tried to leave as many as possible free for you own use in your games....

Lost Game Event - Shmupkit

A simple GAME OVER message, similar to the GET READY one in the Restart Screen Event: EVENT LOSTGAME AT 10 12 REPEAT 10 READ A CHR A...

Kill Player Event - Shmupkit

What happens when a player is killed?, we decrement their lives and update the lives counter on screen EVENT KILLPLAYER SUBTRACT 1 FROM...

Comments


Want to support my work?....Buy my games!

aboutME

Hello, I'm Bruce and I write games for old 8bit computers using Jonathan Cauldwell's excellent Multi-Platform Arcade Games Designer (MPAGD)

I've written a few successful* games for the Sinclair ZX Spectrum and MSX platforms that have been (largely) well received including Twenty Four Hour Parsley People scoring a 10 out of 10 on Planeta Sinclair.

In my blog I am sharing lots of the code that I wrote for my games, in a way that you can use in your own games.   I've commented it so that you'll learn some of the techniques I use to create interesting new mechanics and help your games stand out from the pack.

MPAGD includes lots of standard scripts, they're great to get you started, but if you're new (or just rusty) when it comes to writing code, hopefully my tutorials will help you get started and  turn your imagination into awesome 8 bit games!

All my code is free to use and do with as you please, but if you find them useful please feel free to buy me a coffee ...or better still - buy or download my games :)

*successful is a very relative term in 8bit computer games

bottom of page