Neat, simple flash game...

Miscellaneous Forums/General Discussion/Neat, simple flash game...

Boomshine

Interesting, I just realized I've been playing it for the past 30 minutes. Simple, yet addictive.

This is quite good... having a second bash at it now I've got the hang of it..

Simple, yet addictive.

T'is a bit.

I think I'm going to code a blitz version of this tomorrow. Should only take about 30 mins - less, prolly. :)

This is quite good... having a second bash at it now I've got the hang of it..
It's a typical 'just one more go' game, which is always a good thing. :)

Was just thinking about doing a blitz version.. though 3d..

Yeah, 3D. I have no choice because I only have Blitz3D and want alpha blending. :)

will try later. Thanx.

You could use that shatter mesh code in arcs...

Hmm, that's an idea. I'd still have to have a radial explosion of some kind to trigger the chain reactions though, obviously. Mind you, that exloding mesh code is quite CPU intensive, so I wouldn't want too many going on at once. I guess I could make them explode quicker, or something, though...

Level 11 is proving tricky - so close to reaching the target several times, but not quite getting there...

Was just thinking about doing a blitz version.. though 3d..

lol, who isn't? i was too.

if we hand together we could actualy make it more fun.
Instead of having sheres, we use creatures. and add terrain :) mebe smothing make drop a bomb.

hmm....

i really got an idea, lets do this:
- make terrain (scene = airfield)
- have a guy moving arrount fuel-tanks on a carriage (or use a truck)
- control an airplane
- drop a bomb by pressing SPACE and use arrows to turn the airplane.
- particle effects

i can do modelling and textures :)

Nice game! :)

Dabz

Be good to have spheres though, rolling over a terrain.. use a physics engine etc..

Have bonus spheres with different types of explosions - some last longer etc..

This could either be a little competition of a community project... I opt for the latter personnaly... but then I would because I like to learn how to code!

Anyway... here's a starter for 10...

[edit] Updated! [/edit]

Graphics3D 800,600,32,1

SetBuffer BackBuffer()
camera = CreateCamera()
MoveEntity camera,0,0,-30

Global tBlob = BlobTexture()

Type Blob
	Field Mesh,xs#,ys#,Rad#,Exploding,Timer,r#,g#,b#,tr#,tg#,tb#
End Type

; Create some blobs
Global Cursor = 0 
Global Finished = False



; The Game!


Data 1,5,2,10,3,15,5,20,7,25,10,30,15,35,21,40,27,45,33,50,44,55,55,60,99,0


gmid = GraphicsWidth() / 2
score = 0

Repeat

Read Target,Blobs

If Target <> 99 Then
	Repeat
	
	Repeat
	Cls
	
	Text gmid ,20, "Total Blobs: " + Blobs,True
	Text gmid ,50, "Target : " + Target,True

	Text gmid ,150, "Click to start",True
	
	Flip
	
	If KeyHit(1) Then End
	Until MouseHit(1)
		
	BlobsLeft = Game(Blobs) 
	
	score = score + (blobs - BlobsLeft)
	
	
	Repeat
	Cls
	Text gmid ,20,"Total Blobs : " + blobs,True
	Text gmid ,40,"Blobs Left : " + BlobsLeft,True
	Text gmid ,60,"Blobs Blobbed : " + (blobs - BlobsLeft) + " / " + target,True
	Text gmid ,100, "Score : " + score,True
	
	Text gmid ,150,"Click to Continue",True
	
	Flip
	If KeyHit(1) Then End
	Until MouseHit(1)	
	
	
	Until target - (blobs-blobsleft) <= 0
EndIf

Until Target = 99	


; End of the game!


Function Game(Blobs)

	Finished = False
	Cursor = BlobCreate(0,0,1,True)
	
	For n=1 To Blobs
		BlobCreate(Rnd(-20,20),Rnd(-20,20),Rnd(1,2))
	Next
	
	ups=120
	period=1000/ups
	time=MilliSecs()-period
	
	; Main Loop
	Repeat
	Repeat
	elapsed=MilliSecs()-time
	Until elapsed
	tic=elapsed/period
	For k=1 To tic
		time=time+period
		ticks=ticks+1
	
		BlobUpdate()
		
		
		mx# = MouseXSpeed() / 20.0
		my# = -MouseYSpeed() / 20.0
		MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
		
		
		
		If Not finished Then
			b.blob = First blob
			If Not b\exploding Then TranslateEntity Cursor,mx,my,0
			If MouseHit(1) Then b\exploding = True
		Else 
			found = False
			For b.blob = Each blob
				If b\exploding Then found = True:Exit
			Next
			If Not found Then tick = True
		EndIf
		
		If tick Then timer = timer + 1
	Next
		
	RenderWorld
	
	Flip
	Until KeyHit(1) Or Timer = 500
	
	count = 0
	For b.blob = Each blob
		count = count + 1
		FreeEntity b\mesh
		Delete b
	Next
	
	Return count
	
End Function


Function BlobUpdate()
	Delta# = .01
	For b.blob = Each Blob
		If b\exploding Then
			b\ys = b\ys * .99
			b\xs = b\xs * .99
			b\timer = b\timer + 1
			
			If b\timer < 360 Then b\rad = b\rad + (Sin(b\timer)/50)
			If b\timer > 360 Then b\rad = b\rad * .9
					
			For bb.blob = Each blob
				If bb\exploding = False Then
					ed# = EntityDistance(bb\mesh,b\mesh)
					If ed < (b\rad + bb\rad) Then
						bb\exploding = True
						bb\tr = b\r
						bb\tg = b\g
						bb\tb = b\b
					EndIf
				EndIf
			Next
		EndIf
		
		
		TranslateEntity b\mesh,b\xs * Delta,b\ys * Delta,0
		If Abs(EntityX(b\mesh)) > 20 Then b\xs = - b\xs
		If Abs(EntityY(b\mesh)) > 20 Then b\ys = - b\ys
		
		b\r = b\r + ((b\tr - b\r) / 100)
		b\g = b\g + ((b\tg - b\g) / 100)
		b\b = b\b + ((b\tb - b\b) / 100)


		ScaleSprite b\mesh,b\rad,b\rad
		EntityColor b\mesh,b\r,b\g,b\b
		
		If b\exploding And b\rad < .1 Then
			FreeEntity b\mesh
			If b\mesh = cursor Then Finished = True
			Delete b
		EndIf
	Next
End Function

Function BlobCreate(x#,y#,size#,Cursor=False)
	b.blob = New Blob
	b\Mesh = CreateSprite()
	EntityTexture b\Mesh,tBlob
	b\xs = Rnd(-5,5) ;Units per second
	b\ys = Rnd(-5,5)
	b\rad = size
	b\r = 100 + (Rand(0,3)*50)
	b\g = 100 + (Rand(0,3)*50)
	b\b = 100 + (Rand(0,3)*50)
	If Cursor Then
		b\r  = 255
		b\g = 0
		b\b = 0
		b\xs = 0
		b\ys = 0
	EndIf
	
	EntityColor b\mesh,b\r,b\g,b\b
	
	b\tr = b\r
	b\tg = b\g
	b\tb = b\b
	
	EntityBlend b\mesh,3
	EntityFX b\mesh,1
	ScaleSprite b\mesh,b\rad,b\rad
	PositionEntity b\mesh,x,y,0
	b\exploding = False
	Return b\mesh
End Function

Function BlobTexture()

	i = CreateImage(256,256)
	t = CreateTexture(256,256)
	LockBuffer ImageBuffer(i)
	For x=-128 To 128
	For y=-128 To 128
		r = Sqr((x*x) + (y*y))
		If r<128 Then
			c = 255- (r*2)
			WritePixelFast x+128,y+128,(c Or (c Shl 8) Or (c Shl 16) Or ($ff000000)),ImageBuffer(i)
		EndIf
	Next
	Next
	UnlockBuffer ImageBuffer(i)
	
	CopyRect 0,0,256,256,0,0,ImageBuffer(i),TextureBuffer(t)
	FreeImage i
	
	Return t
End Function



Got to level 12 but no further. It's surprisingly addictive!

Haven't done any game programming recently so I thought I'd have a go at a *very* basic BlitzMax version I knocked up in about an hour... I'm very rusty, so the code isn't very clean or optimised, but I'd thought I'd share it anyway...

Updated version including shakes and better stats.

SuperStrict

Framework BRL.GLMax2D
Import BRL.Math
Import BRL.Random
Import BRL.Timer
Import BRL.EventQueue
Import BRL.LinkedList

AppTitle = "Dot Fury!"

Graphics 640,480,0

Global gfxInit% = 1;SeedRnd MilliSecs();SetBlend LIGHTBLEND

AddHook EmitEventHook,TBlob.EventHandler

TBlob.AdvanceLevel()

Repeat
	
	Select WaitEvent()
	
		Case EVENT_APPTERMINATE;End
		Case EVENT_KEYDOWN;If EventData() = KEY_ESCAPE Then End
		
	EndSelect

Forever


Type TBlob

	Global tmrUpdate:TTimer = CreateTimer(30)
	Global lstBlobs:TList = New TList, lstExploding:TList = New TList
	Global valLevel% = 0, valCount% = -1, valScore% = 0, valShake# = 0
	
	Const blastradius% = 50
	
	Field x%, y%, growth# = 1.5
	Field direction%[2]
	Field color%[3]
	Field radius# = 10
		
	Function AddBlob:TBlob()
	
		Local tmpBlob:TBlob = New TBlob
		
		tmpBlob.x = Rand(0,GraphicsWidth());tmpBlob.y = Rand(0,GraphicsHeight())
		
		While tmpBlob.Dead();tmpBlob.direction[0] = Rand(-3,3);tmpBlob.direction[1] = Rand(-3,3);Wend
		tmpBlob.color[0] = Rand(0,255);tmpBlob.color[1] = Rand(0,255);tmpBlob.color[2] = Rand(0,255)
		
		
		lstBlobs.AddLast tmpBlob
		
		Return tmpBlob
				
	EndFunction
	
	Function DrawBlobs()
	
		SetOrigin(Rand(-valShake,valShake),Rand(-valShake,valShake))
	
		For Local tmpBlob:TBlob = EachIn lstBlobs
		
			tmpBlob.Draw()
			
		Next
		
		SetOrigin(0,0)
		
		SetAlpha 1.0
		SetColor 255,255,255
		DrawText "Level " + valLevel,0,0
		DrawText "Score: " + valScore,0,GraphicsHeight()-TextHeight(" ")
		If valCount >= valLevel Then SetColor 0,255,0
		DrawText Max(valCount,0) + "/20",GraphicsWidth()-TextWidth(Max(valCount,0) + "/20"),GraphicsHeight()-TextHeight(" ")

	EndFunction
	
	Function UpdateBlobs()
	
		If lstExploding.Count() = 0 Then
		
			If valCount >= valLevel Then
			
				valScore:+valCount
				AdvanceLevel()
				
			ElseIf valCount >= 0 Then
			
				valLevel:-1;AdvanceLevel()
				
			EndIf
		
		EndIf
	
		For Local tmpBlob:TBlob = EachIn lstBlobs
		
			tmpBlob.Update()
			
		Next
		
		valShake:*0.5
		
		For Local tmpBlob:TBlob = EachIn lstExploding
		
			tmpBlob.Explode()
			
			For Local tmpTestBlob:TBlob = EachIn lstBlobs
			
				If Not tmpTestBlob.Dead() And Sqr((tmpTestBlob.x - tmpBlob.x)^2 + (tmpTestBlob.y - tmpBlob.y)^2) <= (tmpBlob.radius + tmpTestBlob.radius) Then tmpTestBlob.Detonate()
				
			Next
			
		Next
		
		
	EndFunction
	
	Function DoMouseBlob()
	
		If valCount >=0 Then Return
	
		Local blbMouse:TBlob = AddBlob();blbMouse.x = MouseX();blbMouse.y = MouseY();blbMouse.color[0]=255;blbMouse.color[1]=255;blbMouse.color[2]=255;blbMouse.Detonate();valShake=0
	
	EndFunction
	
	Function EventHandler:Object( id%, data:Object, context:Object )

		Select TEvent(data).id
						
			Case EVENT_TIMERTICK
				
				If gfxInit And TTimer(TEvent(data).source) = tmrUpdate Then
				
					Cls
					TBlob.UpdateBlobs();TBlob.DrawBlobs()
					Flip
					Return Null
				
				EndIf
				
			Case EVENT_MOUSEDOWN
			
				If TEvent(data).data = 1 Then TBlob.DoMouseBlob();Return Null
		
		EndSelect

		Return data
	
	EndFunction
	
	Function AdvanceLevel()
	
		ClearBlobs();valLevel:+1;valCount = -1
		
		For Local i% = 0 Until 20;TBlob.AddBlob();Next
	
	EndFunction
	
	Function ClearBlobs()
	
		lstBlobs.Clear();lstExploding.Clear()
	
	EndFunction
	
	Method Explode()
		
		If radius <= 0 Then Remove() Else radius:+growth;growth:-0.04
			
	EndMethod
	
	Method Dead%()
	
		Return (direction[0] = 0 And direction[1] = 0)
	
	EndMethod
	
	Method Detonate()
	
		direction[0] = 0;direction[1] = 0
		If Not lstExploding.Contains(Self) Then lstExploding.AddLast Self;valCount:+1;valShake = 15
	
	EndMethod
	
	Method Draw()
	
		If Dead() Then SetAlpha radius/blastradius Else SetAlpha 1
		SetColor color[0],color[1],color[2]
		DrawOval(x-radius,y-radius,radius*2,radius*2)
	
	EndMethod
	
	Method Update()
	
		If x < radius Then direction[0] = Abs(direction[0]) ElseIf x+radius > GraphicsWidth() Then direction[0] = -Abs(direction[0])
		If y < radius Then direction[1] = Abs(direction[1]) ElseIf y+radius > GraphicsHeight() Then direction[1] = -Abs(direction[1])
	
		x:+direction[0];y:+direction[1]
					
	EndMethod
	
	Method Remove()
	
		lstBlobs.Remove Self
		lstExploding.Remove Self
	
	EndMethod
	
EndType


I'm sure that someone will be able to improve it. Btw, is this kind of thing legal - replicating someone else's idea in a game? If not, I'll remove the code immediately.

Cheers


Seb

Damm some of you guys are fast. I was thinking all day of doing this game sometimes in the near future and already someone already wrote a near perfect one :p

Finished at about 244 points :S

You know i'm wondering how some of these players get scores like 572 in this game. I mean...is that even frickin possible? It turns out that the game occasionally glitches and leaves one of the "blooms" active for a little while and doesn't fully dissapear, thus crankin in more points for yourself. Thats how I got my 272 :p

Hey! That code is pretty good - will try a 3d version - top down but with terrain..

Going over the terrain will give the blobs (spheres) a random speed which may (or may not) add to the game.

Have a play with it this weekend..

i got 275 :)

279 ;-)

But still only ranked 36 on the daily high score... more practice I guess.

Some of those high scores are insane. And it seems someone has found a way to cheat, looking at the top monthly score.

[edit]It's just occured to me what this game reminds me of: Missile Command.

thats pretty fun, annoying at higher levels though.

Woohoo, got a final score of 252 - Level 12 is the last level unfortunately. I was hoping to try and clear the whole board. Good fun for a few minutes though :)

Nice simple and yet very addictive.

My topscore 261