Zit Zapper Game

Blitz3D Forums/Blitz3D Beginners Area/Zit Zapper Game

Zit Zapper is a simple game based on images and simple maths collision. The game play elements are simple: zap the zits as they pop up with your mouse. The game increases with difficulty with time. Earn bonuses or penalties dependent on the Zits that remain with each wave.

The ideas here is to add game play elements and watch this simple 99 line code game evolve in many directions based on simple collision interactivity. Add movement, images, sound, controls, etc.
AppTitle("ZitZapper")
HidePointer()

Graphics 300,200,16,2
SetBuffer(BackBuffer())

Type zit
	Field x
	Field y
	Field state
End Type
zitsize=16
zitspawntime=64
zitspawntimer=zitspawntime
zitwave=24
zitwavecounter=0

zapperwavecounter=1
zapperradius#=zitsize+1.5

;main looop
While Not KeyDown(1)

	Cls()
	
	;DrawImage Pic_Of_Unfavorable_Person_Here,0,0
	
	;create new zit
	If Not zitspawntimer 
		zit.zit = New zit
		zit\x=Rnd(GraphicsWidth()-zitsize)
		zit\y=Rnd(GraphicsHeight()-zitsize)
		zit\state=1;alive
		zits=zits+1
		zitwavecounter=zitwavecounter+1
		zitspawntimer=zitspawntime
	Else
		zitspawntimer=zitspawntimer-1	
	EndIf
	
	If zitwavecounter = zitwave
		zapperwavecounter=zapperwavecounter+1
		zitspawntime=zitspawntime-4
		zitspawntimer=zitspawntime
		If zits<=2 
			zapperpoint=zapperpoint+(1000*zapperwavecounter) ;bonus
		EndIf	
		zitwavecounter=0	
	EndIf
	
	;zapperper position
	zapperx=MouseX()
	zappery=MouseY()	
	zapperb1=MouseHit(1) Or KeyHit(57)
	
	;zit draw and collision detection	
	For zit.zit = Each zit
		Select zit\state

			Case 1;alive
				;draw
				Color(255,0,0)
				Oval(zit\x,zit\y,zitsize,zitsize,True)
				;collision
				
				If ( (zapperx-(zit\x+(zitsize/2)))*(zapperx-(zit\x+(zitsize/2))) + (zappery-(zit\y+(zitsize/2))) *(zappery-(zit\y+(zitsize/2))) )  < (zapperradius*zapperradius) ;http://freespace.virgin.net/hugo.elias/routines/r_dist.htm
					If zapperb1 
						zit\state=0;dying
						zits=zits-1
						zapperpoint=zapperpoint+ 25*zapperwavecounter
					EndIf		
				EndIf
				
			Case -16;dead
				Delete zit
				
			Default;dying
				zit\state=zit\state-1
				zitflash=255-zitflash
				Color(zitflash,zitflash,0)
				Oval(zit\x,zit\y,zitsize,zitsize,True)
				
		End Select			
				 
	Next
	
	If zits<>10
		AppTitle("ZitZapper S:"+zapperwavecounter+" N:"+zitwavecounter+" Z:"+zits+" P:"+zapperpoint)
		Color(0,255,0)
		Line zapperx-(zapperradius/3),zappery-(zapperradius/3),zapperx+(zapperradius/3),zappery+(zapperradius/3)
		Line zapperx-(zapperradius/3),zappery+(zapperradius/3),zapperx+(zapperradius/3),zappery-(zapperradius/3)
	Else
		AppTitle("ZitZapper GAME OVER: "+zapperpoint)
		Color(255,255,0) 
		Text(GraphicsWidth()/2,GraphicsHeight()/2,"GAME OVER",1,1)
		Flip()
		WaitKey()
		End
	EndIf
	
	If KeyDown(57) WaitKey()
	
	
	Flip()
	
Wend
Controls: Mouse & LMB

Goos work! If only B3D had the ability to synthesize sounds from a call stating frequency and duration as well you could have added sound too!
-RZ

Sounds like the game certainly hit the spot with RZ :D

:P Fun!

Gives me an idea.....
WartBlaster3D - with awesome realistic graphics of course! ^.^

Should you do the spewing pus as a sprite or a deformable mesh?
;)
@luke: That was a truly bad pun.... I feel pain!
-RZ

Thanks Guys. I've improved the targeting with distance function in the original code segement.

This is actually one of a series of small games I developed for my research to identify and classify Addictive Game Play Fun Factors.
Here are just a few generic Fun Factors I believe I have identified (more research is needed):

1. Graphics and Sound
2. Game Refresh Rate
3. Responsive Control
4. Game Pace
5. Upgrading
6. Memory Recall

Dont zap your zits, it irritates the skin and causes more to appear. I lost zits when i stopped touching my face.

No, come on seriously, do you think we wouldn't realise what this thread is about? Its ok to talk about your zit problems, ask for more help if you need it.

As for your "research" thats just hilarious.

Improved the point system: removed penalty, game over w/ 10 zits on screen.