Write A Game in 24 hours Contest!

Miscellaneous Forums/General Discussion/Write A Game in 24 hours Contest!

I'm feeling inspired!

Rules:
Must be written with a Blitz Language.
Requires No External Media.
Single File.
Must be written within the 24hr window starting from this date - be honest.
Post code as entry.

on what date? How do you prove you didn't cheat? Does it have to be 24 continuous hours or spread out over say a week.

SeedRnd MilliSecs() 
N = Rand(1, 10)
Print "I'm thinking of a number between 1 and 10"
A$ = Input$("What number am I thinking of?")
Select A$ = N
   Case True  Print "You guessed correctly!" 
   Case False Print "You guessed wrong.  Stupid!  You're so stupid!"
End Select


haha what a pointless Case statement, what happended to good old IF ... THEN ... ELSE .. ENDIF, hmm actually thats more lines.

oh yeah prize? ... and don't say "universal recognition as a coding god"! ;-)

"hmm actually thats more lines."

Exactly why I used it. I use case statements like this a lot instead of IF, because it is cleaner to read than this:

If A$ = N
   Print "You guessed correctly!"
Else
   Print "You guessed wrong.  Stupid!  You're so stupid!"
Endif


And I can do Select True for those nasty multiple nested IF else blocks:

Select True
   Case A > B Blah()
   Case B > C Blah()
   Case C > D Blah()
   Default Blah()
End Select


Rather than:

If A > B
   Blah()
Else
   If B > C
      Blah()
   Else
       If C > D
          Blah()
       Else
          Blah()
       Endif
   EndIf
EndIf


the contest is over tomorrow at the same time of this post. im too busy programming my entry to really talk.

haha lol frank, too busy.

sswift. Actually i prefer IF for a 2 case scenario but do use Select True for multiples as nested ifs are a pain in the butt. btw Megaman = poof!

hey just realised frank has got a head start!

I've been told im a good for nothing pc bum, so i challenge anybody here to produce a funner game than i can within the next 24 hours. its put up or shut up time. hehe.

looks like you made your website in 24 hours too ;-) sorry that was mean.

Funny challenge, esp. the "no external media" rox :P

i have nothing negative to say about your works listed in your sig...

fair point frank, have you tried any btw?

tetroid, is very good and i cannot wait for iron fist. must get coding if im to win this contest.

B+ is allowed? (as in: run the game in a canvas, using events)

thanks frank you've made my day :-)

amd good luck in your compo btw, I cannot enter due to workload but do another one soon and maybe...

B+ is allowed

weapons are in

updated below

aw frank I can't compile it as I'm BPlus only, anyway keep going, burn that midnight oil (what time is it there anyway? it's 00:51 here (Tuesday morning).

AppTitle("Casino Simulator Deluxe")
Purse%=500
ThisBet%=5
ThisGame=0
While ThisBet<>0 And Purse > 0
	ThisGame=ThisGame+1
	Print "====================================================="
	Print "  Game:"+ThisGame+" Purse: $"+Purse%
	ThisBet = Int(Input("  How Much To Bet (Default $1, 0 to quit)?"))
	If ThisBet > 0 And ThisBet <= Purse Then
		Odds = Rnd(1,4)
		If Odds = 1 Then
			Print "****    You Win $"+(ThisBet)+"    ****"
			Purse = Purse + ThisBet
		ElseIf Odds = 2 Then
			Print "****    Draw!    ****"
		Else
			Print "****    You Loose $"+ThisBet+"    ****"
			Purse = Purse - ThisBet
		EndIf
	Else
		Print "  You Don't Have That Kind Of Cash!"		
	EndIf
Wend
Print "----------------------------------------------"
Print "You Walk Away With $"+Purse 
Print "--Press Any Key To Quit!--"
WaitKey()
End


Not much, just figured I would start a new :-) Too bad I decided to start another one an hour ago, the deadline is coming close.

Type Block
	Field Img
	Field X,Y
	Field W,H
	Field Speed
End Type

Global PlayerImg,PlayerX,PlayerY,PlayerW,PlayerH

Graphics 640,480,32,2
SetBuffer(BackBuffer())



PlayerSetup(20,20)
CurLevel=1
CurTime = 0
CurScore=0
While Not KeyDown(1)
	If MilliSecs() - LastTime >= 1000 Then
		LastTime = MilliSecs()
		CurTime=CurTime+1
		CurScore=CurScore+100
	EndIf
	If CurTime > 20 Then CurLevel = CurLevel+1:CurTime=0
	Cls
	If CurLevel > 10 Then CurLevel = 10
	Spawn = Rnd(1,10 - CurLevel)
	If Spawn = 1 Then BlockCreate(Rnd(0,GraphicsHeight()),Rnd(14,25),Rnd(14,25),Rnd(1.0,4.0))
	If BlockUpdate(PlayerX,PlayerY,PlayerW,PlayerH) Then CurScore=CurScore-5
	PlayerUpdate()
	BlockDraw()
	Color 255,255,255
	Text 0,0,"Time:"+CurTime
	Text 0,10,"Score:"+CurScore
	Text 0,20,"Level:"+CurLevel
	Flip
Wend
End


Function BlockUpdate(ColX,ColY,ColW,ColH)
	Local Collision=0
	ColP1X = ColX - (ColW/2)
	ColP2X = ColX + (ColW/2)
	ColP1Y = ColY - (ColH/2)
	ColP2Y = ColY + (ColH/2)
	For This.Block = Each Block
		Colid1 = 0
		Colid2 = 0
		TW = This\W/2
		TH = This\H/2
		If ColP1X >= This\X - TW And ColP1X <= This\X + TW Then Colid1 = 1
		If ColP2X >= This\X - TW And ColP2X <= This\X + TW Then Colid1 = 1
		If ColP1Y >= This\Y - TH And ColP1Y <= This\Y + This\H Then Colid2 = 1
		If ColP2Y >= This\Y - TH And ColP2Y <= This\Y + TH Then Colid2 = 1
		If Colid1 And Colid2 Then Collision=1
		This\X = This\X - This\Speed
		If This\X <= (0-This\W) Then FreeImage(This\Img):Delete(This.Block)
	Next
	Return Collision
End Function

Function BlockDraw()
	For This.Block = Each Block
		DrawImage(This\Img,This\X,This\Y)
	Next	
End Function

Function BlockCreate(ThisY,ThisW,ThisH,ThisSpeed)
	This.Block = New Block
	This\W 			=ThisW
	This\H 			=ThisH
	This\X 			=GraphicsWidth() +This\W
	This\Y 			=ThisY
	This\Speed 		=ThisSpeed 
	This\Img 		=BlockSetup(ThisW,ThisH)
End Function

Function BlockSetup(ThisW,ThisH, CR=0, CG=0, CB=0)
	ThisImg 		=CreateImage(ThisW,ThisH)
	HandleImage(ThisImg,ThisW/2, ThisH/2)
	SetBuffer(ImageBuffer(ThisImg))
	If CR=0 And CG=0 And CB=0 Then
		ClsColor(255,Rnd(50,255),Rnd(50,255))
	Else
		ClsColor(CR, CG, CB)
	EndIf
	Cls
	SetBuffer(BackBuffer())
	ClsColor(0,0,0)
	Return(ThisImg)	
End Function

Function BlockStop()
	For This.Block = Each Block
		FreeImage(This\Img):Delete(This.Block)
	Next
End Function

Function PlayerSetup(ThisW,ThisH)
	PlayerW=ThisW
	PlayerH=ThisH
	PlayerImg = BlockSetup(ThisW,ThisH, 10, 50, 255)
End Function

Function PlayerUpdate()
	PlayerX=MouseX()
	PlayerY=MouseY()
	DrawImage(PlayerImg,PlayerX,PlayerY)
End Function



DH: Neat, it gets quite hard too!

DH - LOL. I ran into problem and i considered starting over myself.

...

please compile an .exe when done!

oh dread, I won't make it.. ._.

No 'Columns' from me this day.. 8kb worth of gfx (all in code :) works, cycle/move/build works, scan for triplets or bigger hasn't even started yet..

480 lines sofar, including about 160 for a 256x32 image with colorful marbles..

My entry. Its not exactly like i want. Post your entries regardless.

c e l l u l a r

btw, is there any handy way to check on triplets (and more)
for columns-type games? (horizontal/vertical/diagonal)

Scan the map for a marble and do recursive search for neighbour marbles of the same kind?

Or is there a waaaaaaaay simpler way?

I recently coded a similar thing, but it was quite lengthy, not sure there is a "quick way". Well mine only needs to pass through once, it donsn't need to recurse at all.

whos in favor of extending the contest?

*raises hand

.. in theory, can't guarantee I've time to finish it :P As I wrote above, I need to do scanning of marble-groups.. never did something like that, dunno if I even can do that.

1 day is *very* short btw (ppl also need to sleep, eat, watch some soap-operas, do shopping etc.).. the problem is not the time, I guess everyone could do a little crappy game in a day.. I bet however that most ppl want it to be a nice game, with some decent gfx.. Esp. when external files aren't allowed, ppl might have to invest some time in some store-in-code or store-in-data routines..

.

Mmm, looks like another competition I am going to win - if I choose to enter.

Grey Alien,

I'll post a link for download when i go home.

How about a "Not Write A Game in 24 hours Contest!", now you've all won. :)

Or "talk about the game you'll never finish in 24 hours"
That way we could all participate :D

That way we could all participate :D


Including ENAY? :-P

cellular.exe

The contest has been extended for another 24 hours as of now! Hopefully we can get more entries.

Recap on the rules:
Must be written with a Blitz Language.
Requires No External Media.
Single File.
Post code here or in code archives as a entry.

NOTE: This is not my primary entry. Please scroll down below to "Tank Battle" for my primary entry.

;Mind Reader
;By John Judnich

Type Record
	Field Num
End Type

Global winnings, losses

Cls
Graphics 640,480,0,2
AppTitle "Mind Reader"

Color 255,255,0
Print "Instructions:"
Color 255,255,255
Print "Welcome to the Mind Reader. To play this game,"
Print "simply think of the number 1 or 0, and press a"
Print "key when you're ready. The computer will try to"
Print "read your mind by adapting to your thought"
Print "pattern which is learned over time. Therefore,"
Print "the computer's guesses will not initially be"
Print "very correct."
Print
Print "You get 1 point when the computer can't guess"
Print "you're number, and the computer gets 1 point"
Print "when the computer guesses your number correctly."
Print
Print "The first to reach 10 points wins!"
Print
Print "Note: This program trusts you are honest, and"
Print "that you will honestly admit when the computer"
Print "guesses your number. If you lie, the computer"
Print "will get confused about your brain pattern."
Print "You can delete your brain pattern file at any"
Print "time if you want to start over."
Print
Print "Enter your name below: (this is used to load"
Print "the correct thought pattern file later)"
Color 255,0,0
name$ = Input$()
Color 255,255,255

;Load thought pattern
Cls
Locate 0,0
If FileType(name$+".mnd") = 1 Then
	Print "Welcome back, "+name$+"!"
	LoadPattern(name$+".mnd")
Else
	Print "Welcome, "+name$+"!"
End If
Color 0,255,0
Print "Games won:  "+winnings
Color 255,0,0
Print "Games lost: "+losses
Color 255,255,255
If winnings+losses > 0 Then
	prcnt = 100 * winnings / (winnings+losses)
	Print "Your records indicate that you have a "+prcnt+" percent chance to win."
End If
Print
Print

;Play game
computerscore = 0
playerscore = 0
Repeat
	Print "Think of a number (0 or 1 only), then press a key..."
	WaitKey()
	
	numguess = GuessNumber()
	;If playerscore > 0 Then If 100*computerscore/playerscore > 50 Then numguess = 1-numguess
	
	Color 255,255,0
	Print "Were you thinking of "+numguess+"? (Y = Yes   N = No)"
	Color 255,255,255
	Repeat
		answer = WaitKey()
	Until answer = 121 Or answer = 110
	If answer = 121 Then computerscore = computerscore + 1: numreal = numguess
	If answer = 110 Then playerscore = playerscore + 1: numreal = 1-numguess
	
	;Record the player's number
	guess.Record = New Record
	guess\num = numreal
	
	Color 0,0,255
	Print "Current scores:"
	Print "Computer: "+computerscore+"   Player:"+playerscore
	Color 255,255,255
	Print
	Print
Until computerscore = 10 Or playerscore = 10

Print
Print
If computerscore = 10 Then
	Color 255,0,0
	Print "Sorry!"
	Color 255,255,255
	Print "You lost the game,"
	losses = losses + 1
Else
	Color 0,255,0
	Print "Congratulations!"
	Color 255,255,255
	Print "You won the game!"
	winnings = winnings + 1
End If
Print

SavePattern(name$+".mnd")

WaitKey()
End

;This scans the current brain pattern data to guess the next number
Function GuessNumber()
	itm.Record = Last Record
	If itm = Null Then Return Rand(0, 1)
	itm = Before itm
	
	maxlength = 0
	maxitem.Record = Null
	
	While itm <> Null
		chkitm.Record = Last Record
		itm2.Record = itm
		
		length = 0
		Repeat
			If itm2\Num <> chkitm\Num Then Exit
			length = length + 1
			itm2 = Before itm2
			chkitm = Before chkitm
		Until itm2 = Null Or chkitm = Null
		
		If length > maxlength Then maxlength = length: maxitem = itm
		
		itm = Before itm
	Wend
	
	DebugLog maxlength
	
	If maxlength > 2 Then
		maxitem = After maxitem
		guess = maxitem\Num
	Else
		guess = Rand(0, 1)
	End If
	
	Return guess
End Function


Function LoadPattern(filename$)
	Repeat
		x.Record = First Record
		If x <> Null Then Delete x
	Until x = Null

	file = ReadFile(filename$)
	
	winnings = ReadInt(file)
	losses = ReadInt(file)
	
	While Not Eof(file)
		x.Record = New Record
		x\Num = ReadByte(file)
		DebugLog x\Num
	Wend
End Function


Function SavePattern(filename$)
	file = WriteFile(filename$)
	
	WriteInt file, winnings
	WriteInt file, losses
	
	For x.Record = Each Record
		WriteByte file, x\Num
	Next
End Function


You may have to play it a few times before it begins to guess the numbers you're thinking of with better accuracy. It just uses a simple pattern recognition system to attempt to anticipate what numbers you think of. Even then, it doesn't have very much advantage over a pure random guessing system if you try to trick it.

aaaaaaaah.. my very own columns-triplet-finder works like a charm, and without real magic ^_^

the code blows below


..and it's 03:45 in NL now, I'll read all the curses ("whatever primate has a codestyle like THAT?") tomorrow :P

zZz

I think I'm going to enter a different entry (I'm working on it now). That "game" I posted wasn't very good. I'm currently woring on an idea I have for a game. Hopefully, I'll get it done by the deadline.

Mind reader was very correct! Beat be every time, after a while. And cellular rocked too.

CS_TBL: no data statement lol, what's s$ then haha ;-) It's seems to work well, just need a score and a special effect for matches and a sound effect may I suggest s2$.

'no data' as in: no global datalines ..


Frank: are we allowed to write and read files? (generated files)

are we allowed to write and read files? (generated files)
Sure! A long as it a separate file is not needed to play.

When is this ending? I am interested in joining in :o)

Come on in Valorden, and join the fun!

see below


see below


Here's my primary entry (if only one entry is allowed, please consider this my entry):

Tank Battle!
Drive your tank around the city, hunting down your enemies. You begin by selecting your team (color). Then the game begins, where you and your AI teammates hunt down the enemy. You can command your teammates strategically, giving you an advantage over the enemy. The winner is the team who eliminates all other teams, where you (and the other teams) receive reinforcements.

Controls:

Arrow Keys, or WASD Keys = Tank navigation
Mouse Movement = Turret Control
Left Click = Shoot!
Tab = Change to another tank in your team
Esc = Observer Mode (or exists if you're already in observer mode)
1 - 8 = Issue team command (request backup, attack, retreat, etc.)
P = Pause/Unpause




Download Tank Battle! (Source code - 40KB)

Update: New version with bug-fixes updated
Update: New version with minor fixes and improvements
Update: Bug fixed where only enemy reinforcements would arrive
Update: Added team and scatter modes
Update: Bug fixed where new reinforcements would not follow you if you have team mode set
Update: A "bumper" thing was added to the front of tanks to avoid orientation confusion. Also, enemy AI was improved (now with a better trajectory calculator). Several collision bugs have been fixed as well. All tanks are now repaired when reinforcements arrive.
Update: Better explosions effects added, and minor bugfixes and gameplay tweaks
Update: Now textures are used! (Procedurally generated)
Update: Disabled tank fire bug fixed, hopefully (thanks to sswift). Also I fixed a minor problem where particles weren't displaying correctly after landing on the ground. A AI bug where the turret would move fast in one direction but slow in another is now fixed also.
Update: Now fragments are more realistic, and are the color of the tank (or object) they come from.
Update: AI is much better, where tanks form squads (groups) and attack semi-strategically. Also, tanks who need help call for backup. This way, it's not so easy to totally monopolize the battlefield. Also, you can now read what other tanks of your team are saying to others, and a little of what the enemy says (nothing that would reveal any strategic movements).
Update: Fixed misc. AI bugs, and removed team mode. If you need backup, press Space and tanks will come to you as soon as possible. Also the AI isn't quite as difficult to beat now.
Update: Player now gets backup priority - you don't have to wait anymore for a tank to be "ready" when you call for backup.
Update: Pressing [Space] now brings up a command menu where you can give a variety of commands to your teammates, such as Retreat, Attack, Hold position, Request Reinforcements, etc.
Update: Squad commands now do not "expire" when issued by the player. Also a misc. bug was fixed where AI speech was not properly displayed above the tank.
Update: Fixed bug where squad commands were "expiring" when they weren't supposed to.
Update: Pause key added (P).
Update: Highscore system added. Option to restart game added. Minor bug fixes/tweaks. Now, keys 1-6 can be used to give orders at any time, and Space does not hide/show the orders menu.

Have fun!

/me hits John J. over the head with a codebox.

big10p: I changed it to a codebox now. :)

If anyone has played the old version, please try the new version. It includes a bunch of minor bug fixes with the AI, etc.

Also, I forgot to mention the controls:

Arrow Keys, or WASD Keys = Tank navigation
Mouse Movement = Turret Control
Left Click = Shoot!
Tab = Change to another tank in your team



Hey, pretty neat, John. Sound would be nice, natch. Also, why do you change into a plane when killed? The controls still work and you can fly all over the city. :P

That's "observer mode" where you can sit back and watch the battle if you run out of tanks or don't want to switch to another tank you have.

I may add a key you can press to go into observer mode.

Oh, I see. S'OK then. :)

Update: Now you can press ESC at any time to enter observer mode. Also, there are progressing levels where reinforcements arrive for longer game times.

Here's a hint: If you stick together with you're friends, you're odds are better.

...looking to your 'entry for a 24 hours game' I feel a little insignificant...in 24hours I can't get either starting thinking of a game...create one is out of my neuron-capacity...:-( [I need a mind upgrade...]

Pretty good John J.

I found it a bit confusing moving around. It would be better if you could press a key to automatically turn the tank body in the direction the turret is facing or have something on the base mesh to indicate which is the front.

part 1
Columnz=CreateColumnz()

PlayColumnz Columnz

FreeColumnz Columnz

End


Function CreateColumnz()

	; 00	04	app
	; 04	04	canvas
	; 08	04	imgMarbles
	; 12	04	timer (cursormovement)
	; 16	01	block xpos
	; 17	01	block ypos
	; 18	01	block phase
	; 19	01	block speed
	; 20	01	marble1
	; 21	01	marble2
	; 22	01	marble3
	; 24	04	timer (auto-update)
	; 28	04	mapbank
	; 32	06	musictitle
	; 38	04	sfx1
	; 42	04	sfx2
	; 46	04	sfx3

	bank=CreateBank(50)

	sw=ClientWidth(Desktop())
	sh=ClientHeight(Desktop())

;
	app=CreateWindow("Columnz - by CS_TBL  <Beta 2>",sw/2-200,sh/2-240,400,480,0,1)
	PokeInt bank,00,app
;	
	canvas=CreateCanvas(4,4,8*32,13*32,app) ; marble = 32x32
	PokeInt bank,04,canvas
;


;
; behold, children!
;
; (don't ask :P)
;
s$=   "000120005E505248383941503949514857604858876069585859617056704A584F683950576052785F5882805F706A606E50"
s$=s$+"5150584141405E50724056404940474050505648495040414A40314949404F5048507F50626055595A5951626669535A6A62"
s$=s$+"4A5264624541685A52615A5178494C50604141385E486B504E4848383E4850605748504847404A484141424848594A487F60"
s$=s$+"69485E495438424A3D4037424738463A4041394A49495471525171595358504140385F506258564048484041505050494958"
s$=s$+"40414A4837404140565838507F6063605B51636F5759777661627D76635A777649425B674E694F37705142505F383A305E50"
s$=s$+"735056384038404940485E40584847385250383949404E604148865060685D50838F65689D9672808996738891965D68A49E"
s$=s$+"6169998777584950514141406D505A585E385138464842585E40525846404948304151504760415085606A685E4F81906E6E"
s$=s$+"9FA7778DA59F80869CA75D5E9B9F5E678C67765850585F4039305E5869505E40514848414850604951504638494830414948"
s$=s$+"50594948856073605F4F71695F668C81657E89826B7E80825E6E8391646FA68874585958673839305D486A505E4052404748"
s$=s$+"415011000910080809080A100A0001080108110801080A080A0008080900100812080110090012080108001011080A001108"
s$=s$+"010001000A080A08080800000908110840414A583F3051383049495860715A605F583130597141505E584A48406939486079"
s$=s$+"4A586861616857683B486F683138404931505F5063584E585260675059584841515838314938313951505C6141595B526A62"
s$=s$+"5C62656265626D6A6C6A6E626C5A5C6A5962665A5561665A58495C523D404A495E4862504E58526858615958483950603F38"
s$=s$+"48403851405866614D4847424740423B40394143384141434041494B424149434E51574A4852534A59623B4159415D485958"
s$=s$+"4E504B705E5058584941515047405238303949505B694D6F62627D6E746A7476736A6D76727274767362645E665A5756514B"
s$=s$+"493F413B443F2E4928385D4062584758596850596060403959583E305940394941485E6852977B88918E9B90998E9290898E"
s$=s$+"9288908E95989F9DA6989F9D9AA9AEA5A571AF9D3A51825F66506258565852685F5859584841505838315148384141506677"
s$=s$+"58A07996A59FA6ADACAFA7AD9CAFAEA5A4A7A7A5A4A7A79D99978A8E8E868C668D8E46477B575E506A504D505B6867505960"
s$=s$+"484952503F40593838415150576751797576798A827E8A827B86828A837E827A81867992909E9799A7A59DA9B58DB1B95857"
s$=s$+"AC685E4861584E5051605F6051600908080808100A0000080008101009100800110812080908090801080908120009080108"
s$=s$+"0A0800000908090012000910101008000908120808000A100908090847585070574862685F80727076705A50504952685F68"
s$=s$+"68405F483128475831506961526050494958374841585660405867685A505E38493057705160675061505758497858495968"
s$=s$+"45594A615C6265626C5A63726B6A6A7A7262727A6D626B6A616266625661555A5A5965525F4856525338544A333841294E68"
s$=s$+"5A5867586150486151785949696847493C40394B4941383B505148535760464A6061403B5251474A5B51575248625D52526A"
s$=s$+"656A5B62595A615242414929467052606859595840615070494169604C59556F6C6A7D766C72767E727286867A7A858E746A"
s$=s$+"7F7666525F5E50434A47413B3A473B233D37211B2E1F2D4120204D685B606051505041615068504159684C60639792989096"
s$=s$+"91909F9D9A98A1AEA2A0AAA692A0929EA6989FA5A29998AE9DA19F959F91988697718B6E51416B3F4D684960675861505061"
s$=s$+"5A70594959584C6F61A8A5A59DA7A0A69CA79AA6AEA7A2A6A5B7A0A6ADA7A09E92979F958E96808E8C8E838E7A8677667476"
s$=s$+"563F6B3F4E6851605E50594840615068514159685E6757807B7E7A8A7A8E808A847E898A938E898A8B8E8892888E9092A5A5"
s$=s$+"A5A9B3ADABC1C3BDB2C9B4A5AEA8613F8A4856785260676060500A00010811081200080810080A0808000910010801100808"
s$=s$+"09080A000100121001000000081000100910110812000808080808101008000802081108121011103F504048485142385E60"
s$=s$+"59385E48495058716A6856484A383859425848695A6058694948506158605151585850695060705950504F3048505F485A58"
s$=s$+"5F4851584049404854414161655A6D62656A6C72777988A28E99AEA98F81A09A7A6A897A6F616C6A63515E5251495E525548"
s$=s$+"5F4A4348533A3230403235583640564862503F483A504D413C40423B4041484B48615B726891687A97A0717290896E527758"
s$=s$+"565A5E59565A59525E5A656264625D5A584A5B524C4948422F5036405F4058483F50415052494B776C727476717A848E7892"
s$=s$+"9AAF9D99B3B78E99B3A7897A898F665A625F503B39373C3B3D2F2D2B261F19232627251A201821591A405841595030494148"
s$=s$+"5D484A8F9B9099969BA099A69BA8AEB6ACB8C1C7B4A8C7C69B98ACB6A798A79DA3A9ADA5A799968D8F89898E7F717B766551"
s$=s$+"60573F584E3F5E48515036483A484E5748A09EA5A59F98A69FA7ADAEB6BFA9BFB9C0BEAEC8B0ACB6B8A8A296999F91968B8E"
s$=s$+"82867A7E7D7E8B867F76836E6967775E42485F475F4859483F5842484E574F807A76838283968892889FA7B1ABA7C3B9A29F"
s$=s$+"B5B19696AFA1999E9E99A6A5A4B1B4BDBAC1C2C5C0B9AEA5B79891869480475F6A485E485058100011000A0809080A080100"
s$=s$+"02101010110001100A0811080908090002100908081011080908090809080808010810000810080008080A00090800080910"
s$=s$+"021048416B683F505948583950484F6051586959626046486058405952605F5862584F586070776881705D40594057505150"
s$=s$+"5758394057583A50485942405F6051603E405A584A5A64625C626472788A8FA19AC1B1D9C0C9D8D1C1A9C3B99882A1827E61"
s$=s$+"746A61495F4A4E58584B5B50564A4C404E4A4128402A282022215F604360564862603F424041484B39515B726F9094A1B7D0"
s$=s$+"BFC0DED0B4A1CEB07A6280716C526E61666253626E5A5D626A6A646257515B4A53494E3938312B29505942704E486A585272"
s$=s$+"7676727A7D86868981A7B1C1C8D8D7B8D3D0B2B9D7BF9E81AB9775526157413B4B37342B262F24232F1F281B2F271B222120"
s$=s$+"14292218586131684E4861685A889A969998909EA4A0AFC6C4C8CEDFD6C8D3D0D4B8DEBFB4A8B7AE99A19AA6A699A7959F81"
s$=s$+"91869082817681726D6E6551585F42314B3F5F60326845486260689E95A7A09E9CA7ADAEA9C0CECFCBE0C9C8D3D8CFC7D3C0"
s$=s$+"B6AEB8B0AA96A197828E938E847E7B8686868A7E787F7B7E63676F5E573F43475F6039604D4861606486818A837E7A8A97AE"
s$=s$+"9FB9AEBFC2D9D3C0E6D8CEAFC1C1A99FADA9A1B6A4A1BCB5B3B1CACDC8B9BDBDBFB0B79DAD88847E8B7860575C4057683B68"
s$=s$+"0210080009101200080009080108110809100A00020802000800080011080200101011100A0811100A080208090801080908"
s$=s$+"110811000A08021009101108110877685A5851513A50615961605F60495857584260405969784760525858595B6060716A60"
s$=s$+"78495A303D2859583F305858294930484E704A584D5838585089527863515F606D626C6A6472647A8EB195B1CFE0C6D0E7D0"
s$=s$+"E6D0CAB1BBA19F7998826A61765A67484F5A5B50505B59404F4A4938433A3030282A221834292478145863394C40414B4049"
s$=s$+"575A40697F9986B0C8D1C5D0EED8E6D0C4A9BF988A7A70696E62686266625D5A5B6A656258525D4A5D414B4A3A313E393F28"
s$=s$+"3429348013586A495B677A727D7E6A8A7F7E95B994BFCFD8D4D8E6D0E4D0C9C1C0A8A0829C7F5F4A5A473A333C2F362B252F"
s$=s$+"2A333028262229282A221A20151911102E8819586D685B8F939089969BA0A29EB5C8B9C7D5D8D3E0E6D8DCE0CDC8CDC7ACA8"
s$=s$+"B5B6A3A9B0A6A7899996898A898680827B7E6E616E565B515756423143372E882958756F5898AFA5A3A79AB6AFAFA8D7B9C0"
s$=s$+"D1E8DBD0DBD0E4D8CDCFDBC0BEAEBEAF9B8E9F96828E7A7E85968A8680877A767277746E5D576656564749472D8028586E5F"
s$=s$+"5E707A86828A7C96808AA4B7ABB9D3E0CEE0E3D0DFD0D7BFD0B9A89FACA1AEBDB4B1C2B5B1C9C3BDBFB8BDADB5A89F9D9B88"
s$=s$+"837E7B70684F61483B802A5001000A080900080811081100090812081110110809100908080809100900080012100A080800"
s$=s$+"11000908081011000208000809080A080A081100000808000A084859526847705A685F684B484E50284050494A6056506A68"
s$=s$+"4F5853504E585160565059585E40525050496A584F38594037604A506660415858695250577029484062405A6D62655A6382"
s$=s$+"6A7A9EB98599C9C1BAB9CBC9B2A1BE99A59196797B6262595D5A565857525440484B4A405642474742422F2F3E2920282A11"
s$=s$+"0A3815203B3A3638414347484D62496978A27790BAC9A6A0D3B9B798A08A8680757275615D626A6A65626D62625A5D525E51"
s$=s$+"4A5253495739403934312F202A191C30252847714F76737A7B7E828A777EA4B994A7C2C1B7BFC9B9B8B0C6A1AC979B727B5F"
s$=s$+"514B4437342B24271B33262F292B212825222020282220181D19191017381A285A985D969C90979D9BA8A3AEBCC0A9BFCCC8"
s$=s$+"B8D0CED0CFBFC3B8B9AFA7A8B3A6A499A7A58892998E8F79797E70626D666E5960575341414F3929332F24382028579E5F9F"
s$=s$+"9EA5A4AF99AEA6AFB9C7B1B8D7DFD3C8DFCFD3C0C9C7C2B0ABA6A4A7928E948E8E86898E878E9186898774767C676C666E4F"
s$=s$+"674E463F423F2B402637487F54818B86828A84968F91A2BFA4A9D0D0C0C1D1C8C0C1BBB7ADA1A4A6A3B1ADB5BBB1C9C5C0B9"
s$=s$+"BBB5BEA8A7959C9891868288867672585A575B402E4F23301208090812080908090800080800110809001208011009000900"
s$=s$+"08000A000A0802081210080802000A0009080808090008000110011002080800010808080908777069586059595066504138"
s$=s$+"354839505D487250585172605F405960576051603E5059706F6072585F384950484949685D60515876704B68685962604660"
s$=s$+"51585A6A65626D6A6562737A6B72809A82829FA19681908A8E818F71826A6A596C5A5648564A4C58505342404E424A484C42"
s$=s$+"39383A3A28302C312020181909181D203F423949414B3F40495B4A496C7A60718A8A68698A8270617C726B616E6261625D6A"
s$=s$+"656A5C625C625F59645A4D49595253393F413E283329361820191C201E305B726666736A746E8282747E8F91898FA6A99397"
s$=s$+"A69199979B727967584B533F432334372D23262F33231E272722292823222218251922181A1922180F2812188488999E9B88"
s$=s$+"91969AA0919EACB0A5B6B3B0B7A6B4B8AFB6AEA8ABA6A4A1A8A69F89918E88828A868872736E6F61675E654950474B393A2F"
s$=s$+"2F202D271D281F3781AE949F9DA5A3A7A0AE9EA7B5B6B7B7BEC6B8B8BEBEB9A8ABAEA4A7938E94868B7E8A7E8C86918E7887"
s$=s$+"837E72777D76745F6F5E5E4F514F40383B2722302F2F757680827C7E7A827B8E788A9FA68E99A9BFA599B99F95A19BA6ACA9"
s$=s$+"A6BDBAB1BBC5B8C1BCBDB9C1B4A5B59899969C80947E8370665E624842474338353729300908020809080A00090811080A08"
s$=s$+"090808080A00110809080908020812000A10081008100A0008080110100001100900111001000A0802081208091001080210"
s$=s$+"50515160573869483839484848615068775068586F606160676062604E5842505F60625067585A404E383A504F586A705F50"
s$=s$+"59304F6038604E486A604051504850624C62646A665A6B6A5E62637A6C6272726B627E696D6A6C61565A51595E525E48584B"
s$=s$+"5548464A4B484C42373F382A362F3729372F2C2110181F10112015184F4A4B4939434A4948435249566250515E624A61655A"
s$=s$+"5E61665A526A6D6A5B5A5D62656261525B52575159424C49413A49393D392E283C212C2027101B201C2065725F666B626D6E"
s$=s$+"6B6A6676737A7E76827A687775626157604B42474233352F2423261F232B2D2718232020251A212021222120141912101019"
s$=s$+"13081F1013189EA0899E9C909E9D9390A79D9DA0A196A5A0A0A6A199A19EABA9A69DA5999E95899288868F798A766F697466"
s$=s$+"6651605755494A3F3B31342F2E101F1F1D30193088A68B9FA7ADA5A7AEA5A59798A69EAFA8AE9B9FA996A18F99968F868B8E"
s$=s$+"828E8C96818E8F867A76787F75766C676E5E5D575756574F523F3118352F1B28282089867E8982869192818681929486908A"
s$=s$+"939E989AA1A6ACA9B5BDA4B1B3B5BAC9CCC5C0C1C4B5AFA0A7A5A490928E8C78756E7A6067565A4034373A2025371A300900"
s$=s$+"0A10101011100A000A0001100A0009100008110008101200110009000110000801080A000808080809100900080802001008"
s$=s$+"020801080A080810100801085949425046385960416178706A717268594951484E5859584D404A4045504A60473050583F50"
s$=s$+"48504F5051705E6068503F383A505780737065384030374841484B61385A6769565A5962665A67615D52685A5F5A5D615E5A"
s$=s$+"61595E525E5056525548564A4B383B4239383A32372F28322F2F262121182111091016080B200D203B4A42514F4A5D59484B"
s$=s$+"5D514F5256594F5A565157525852565A64625E6A65625A625B5A57494B4A544949424341453138312B292428312113081D10"
s$=s$+"15201D3043623A4F656250575E6248575F6A4F566F5A5746484B513F4A3B3C2F2C2B353723232D27271A2627242221182122"
s$=s$+"291826211A1813211B181D08131816201A3071995CA69E98989E9FA0A69D98A1979DA2A198A6A3A1A59DA699A09EA799988E"
s$=s$+"97798A767F617E6E7659675E5549524F43313A2F31292E271C20171725181E376CA65B8F989E899790969997989E9197A19E"
s$=s$+"889F91868E8E8A86847E838E8A8E87867376797F7B7E696F6D66645F565E564F523F4F2F3B3722201E2723282E3765966291"
s$=s$+"909E97A1888E9FA18F95909A9FA59EA1ADADB5B9BDC5ABB9B2BDB8B1B3BDAFA8AEA59E90908693787C767B6068575A50493F"
s$=s$+"4838352F3128262F3130011011101108010808100810080808000108090809080908081000080A100A080108111011081100"
s$=s$+"0108080009100008090800000910000808080808100811105F5069503F50505850596958594961684F386150664869505740"
s$=s$+"514856585148465850704E6859605D805268605950504F5860606E5862402F28292837586268506174395E515D6254596552"
s$=s$+"5C5966525B515F5A5A595D5A575050535D48554A4D403C423A3831423A3030322A20252130181A1118102710101016181340"
s$=s$+"13584E516A515F4A58625652585A564A5F594E62515A555A546A6C5A6C625B5A5C525952495A4D4148423A4146313F283421"
s$=s$+"3628322125201E180B101D1825401C584F396E2F5043384F48433A4F514341474A4B423F42333A37333333272B332C1F1823"
s$=s$+"1E272C221920222A28181F2119181A1118081E10091016081A1816300A5858A9707FA1A1AEA59999A6A5AB99A6A5A5A1A69D"
s$=s$+"9EA9989E989A978D8F89897E86716C66675957665549514F52413A3F3839353725182F272520271715481860558F756F999E"
s$=s$+"8E868A9E859698868E8E8A8E8C868B867C7E8B8681868E86827E7F7E6B767367756E5C5F5F5E574F494F4F3F433731203527"
s$=s$+"1818262F24481858629F6788A79DADA9AEADA4A1A6A5A6A9ADB5B5A9ACB5B2C1BBBDB3C1B3B5B0A1B6A5A6989A9693807B76"
s$=s$+"83686D6E635858474A38462F3B30271F29202B403160080009100908011012000900010012000A00110809000A1008081108"
s$=s$+"101009080208000809000A080900011011081108111000080908090810081210090808106648624849494138505949585768"
s$=s$+"5A60505150585F404858776862685738523858795A6067704A485D60483850514238574051404F3851482E30475F5E587B70"
s$=s$+"763864405F503D525959565258594853505150534F50554A4E50544A55483A3A433039323230313230202E2921202B192818"
s$=s$+"1708101816181A101D103E586A7060496A40655A4A625552635A6562635A565A6A62655A5B5A5B52514A584A594A4E51483A"
s$=s$+"42393F3932392B2937302B212C1816201C1815181A101D203E686B78704158403A4323373A333B373B332D374233342F282B"
s$=s$+"3437282B2E27261A26272E221F1F2C2221201E1912201E19211810191A100E1011180E100A0830616A686750674795A171A6"
s$=s$+"AEA19096A6999F9DA5999E95A59997859581837E7D79736E75616E565C49504F4A413B3F42312C2F2D182F1F1C1027172518"
s$=s$+"1E273F68716866505F4F83866A86827E7A8E8386817E828E7B7E848E837E747E7B7E706F6C6E68776556625F605F5D5F5147"
s$=s$+"4D473C3738202E271F1F2E2718281E2F3E68697064585B38B5BD8BB9AAB5B9B9BAB5B9B9B3BDC2B1BBB5A9B1ADB5A8A9B69D"
s$=s$+"9E9088968580828672607E5E6358585F523844373B3035273030362F29283E60727812080008000008081110081010100910"
s$=s$+"011008080908090801081110090009081108010809000910101009080A080800091011081008101009081208080800084D38"
s$=s$+"526850595250576049505760536855685360576841484E50392847203138475051586F585368585961585748595047504868"
s$=s$+"47485960386941786D586A7046404A68355042314E504C425E5854425E404442455042423D48424242403F3142303F393228"
s$=s$+"2D29292023112910260818081510101017080A302C60656061803E3851684C6140416462525A5B625B5A62525A5252524852"
s$=s$+"5F514A424F51404A45313F39393134312F2021292418101913101E1824181D1015282B6075586A80464049603D314F372833"
s$=s$+"3627292B2E1F392B262729231E1F2D2A26171B12171F1A1A2727181A1F2714111A08101119181608191016181A1015301960"
s$=s$+"67586B783F40595848894B4F9581797E868982868D81727E86797A76757973666369555E6351474E4A49393730313B2F3620"
s$=s$+"2F171D2027171D1816271D38216077606A783F484960457F4B4F8C7E6A6E84867B6E8586746E7576736E766E666E6A5F5E66"
s$=s$+"545F50575357484F4F3F443738282C271F27262728201E27233028606D6069783F4050685ABF5458C5BD98A9C3B5A1A9AEA5"
s$=s$+"A099A0A6A09998A697889B8687807C866C707766645059574A4843373228352F2A202E2F2220283032587560718009100108"
s$=s$+"01081100080802100A10090012080908091012080910111001080110090809100A1000080A10090802080908090012101100"
s$=s$+"0908080812080808100847704A7067604B5857585970605960384D483A4067505A5040295140474851785F5863605F583138"
s$=s$+"5650293840514A50607163484E505A584F705A48575043603E605A705E5841683D405A413D48393A4448393244383F393A38"
s$=s$+"30323A38252130202421282022211818271010181D1009101E101B201C50466853505F584A583E684A705760496043495149"
s$=s$+"484A3F414649404246494F393C413C393941333138312A21372019212618101923181D101A201D18262023504F7859504E60"
s$=s$+"5160376849785E6049682E31583824222F1F241A1F1F241A271F222226272022161F271910180A191210170819180D081A08"
s$=s$+"161809181F1821504678525048514360476851785F584A585971535F727165666B715D66726156566B6158474A494A474941"
s$=s$+"3B3F3831362F26201F271C1826271E181E271D2821504F7852504F604A603E6852785E585258466F555F68775E666867575E"
s$=s$+"69676756615F5947535F413F543F313F4547343730281E2718201D2F27272527232028503F705850566043603E605A705660"
s$=s$+"525864A75D6898968F80919E86789A967D788C7E7C607E7E635067564A485A474340442F2A302C2F32282427303030303250"
s$=s$+"40715A4857584A600900090009080A08020809100910090808000800110801100808120809000810010009000A1001080810"
s$=s$+"0A0809000800090009100208091001000808090809105F706170587152705F606260474838485C785A707640623040394938"
s$=s$+"5F7053505F4058402D3852603F30514847385A5850315058464072604E487360464849506770587056705B60505962683630"
s$=s$+"3738353834293B282D212C281C212A202A21211018111A1015080A10171812181E201418245046406A68564872584F405958"
s$=s$+"5F806968586963705F605968314135383C393A29322934293A312A2926281821362025181D18161824181C181D201E202620"
s$=s$+"345038496B605E507B60504950505F7858705E686268576063582A1939381D192F17201A0F1F0C1111100C1908100F081108"
s$=s$+"07080208101110080E0811181E1822504748736055507B58574859585F7859705E705260576851584658344F5758393F4849"
s$=s$+"43473F48432F3F383B2F352035272D101E1F1D181F271618172F17203050474069604D587258575051505770517858715168"
s$=s$+"5E60596040503E474C4F4A3F4A47423F444F3B373D3F3B273E2F251F20281D272F272E2F28201D2F2A30374F464863704D48"
s$=s$+"71684F4050506071616858715A6858615A68556F4348766E545867666450606F5450584F4B40444F3B303527232826272928"
s$=s$+"2D2F323033303350463872604E586A6057505250090810080900120801081108080801101200090809080908090809001200"
s$=s$+"00000A000008000001000008091009081210090810000A08091001080908080011106F606160585960584748483829513A40"
s$=s$+"6F48584840295040475051604F6051584548416858616B605E586350606161405859515058697B686E587C58504939405F60"
s$=s$+"625060496250463840402951314867385A482D185D38242034281B081D201B0826281A102E401B2045484D50604858516158"
s$=s$+"68597B78765873504E4039385E706258585961504738484028592948774061482E2053401E1835201D1026281D2025281418"
s$=s$+"24301D184C48475859485961616058597A60755873584F40383867605858505158484640404028593248773059481F105238"
s$=s$+"1700292008091818100912280001223006103A483D5051405851595867607B607D586A505740323867685158595161504748"
s$=s$+"4948205928486F3859482E3057472520373725182F2F2C201F371D103747262840504750595067605A586F6082706F587458"
s$=s$+"4740393866685158575850504F38413828592940764051502B20594021183F372028282019202727211827471B2041504049"
s$=s$+"51505859616071597A6076607B58564832406F706060574850484F405140285929407640524842305B48363F3A382E272238"
s$=s$+"2E2F2A282F2F3940203042484F585148585158585F60727076606C5840393A4010100108090001080A080210090808081200"
s$=s$+"01001208110008080208001009080908101009100108091009100900101008000908011011000910120008101108"


	h$="0123456789ABCDEF"
	l=Len(s$)
	ibank=CreateBank(l/2)
	For t=0 To (l/2)-1
		m$=Mid$(s$,1+t*2+0,1)
		p=(Instr(h$,m$)-1)*16
		m$=Mid$(s$,1+t*2+1,1)
		p=p+(Instr(h$,m$)-1)
		PokeByte ibank,t,p
	Next



	width=PeekShort(ibank,0)
	height=PeekShort(ibank,2)

	imgMarbles=CreateImage(width,height)
	SetBuffer ImageBuffer(imgMarbles)

	offset=4
	
	For y=0 To height-1 Step 2
		For x=0 To width-1 Step 2

			k=(PeekByte(ibank,offset) And 7)+8*(PeekByte(ibank,offset+1) And 7)
			j=(PeekByte(ibank,offset+2) And 7)+8*(PeekByte(ibank,offset+3) And 7)

			If k>31 k=k-64
			If j>31 j=j-64

			For pixel=0 To 3

				yc=PeekByte(ibank,offset+pixel)/8

				r=yc+j
				g=yc+k
				b=((5*yc)-(2*j)-k)/4
				If r<0 r=0
				If r>31 r=31
				If g<0 g=0
				If g>31 g=31
				If b<0 b=0
				If b>31 b=31
				
				Color r*8,g*8,b*8
				px=pixel Mod 2
				py=pixel / 2
				Plot x+px,y+py
				checksum=checksum+r+g+b
			Next

			offset=offset+4
		Next
	Next

	SetBuffer DesktopBuffer()

	FreeBank ibank

s$=   "494D504D436F6C756D6E7A202D2062792043535F54424C00000000000000041006000B0009000500170214020D000600800C"
s$=s$+"067D80000000000000005E8B0EE4201C281C2024201828202020281814202C30202020202020202020202020202020202020"
s$=s$+"2020202020202020202020202020202020202020202020202020202040404040404040404040404040404040404040404040"
s$=s$+"4040404040404040404040404040404040404040404040404040404040404040404040404040404040400001020304FF4401"
s$=s$+"00006E03000098050000C2070000EC090000160C0000400E00006A10000094120000BE140000E81600001219000062190000"
s$=s$+"B2190000021A0000521A0000A21A0000F21A0000421B0000921B0000E21B000052210000D8260000282B0000FB3000000300"
s$=s$+"81332660430E00008133F260CBD200008133387F930B0000494D5049000000000000000000000000000000000000003C80A0"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000FFFFFF000101010201030104010501"
s$=s$+"06010701080109010A010B010C010D010E010F0110011101120113011401150116011701180119011A011B011C011D011E01"
s$=s$+"1F0120012101220123012401250126012701280129012A012B012C012D012E012F0130013101320133013401350136013701"
s$=s$+"380139013A013B013C013D013E013F0140014101420143014401450146014701480149014A014B014C014D014E014F015001"
s$=s$+"5101520153015401550156015701580159015A015B015C015D015E015F016001610162016301640165016601670168016901"
s$=s$+"6A016B016C016D016E016F017001710172017301740175017601770100020000000040000040640000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000020000000000000000640000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000"
s$=s$+"0000640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"00000000000000000000000000000000000000000000000000000000494D5049000000000000000000000000000000000000"
s$=s$+"003C40A00000000000000000000000000000000000000000000000000000000000000000000000FFFFFF0002010202020302"
s$=s$+"0402050206020702080209020A020B020C020D020E020F0210021102120213021402150216021702180219021A021B021C02"
s$=s$+"1D021E021F0220022102220223022402250226022702280229022A022B022C022D022E022F02300231023202330234023502"
s$=s$+"36023702380239023A023B023C023D023E023F0240024102420243024402450246024702480249024A024B024C024D024E02"
s$=s$+"4F0250025102520253025402550256025702580259025A025B025C025D025E025F0260026102620263026402650266026702"
s$=s$+"680269026A026B026C026D026E026F0270027102720273027402750276027702000200000000400000406400000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000200000000000000006400000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000"
s$=s$+"0000000000006400000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000494D50490000000000000000000000000000"
s$=s$+"00000000003C40A00000000000000000000000000000000000000000000000000000000000000000000000FFFFFF00030103"
s$=s$+"020303030403050306030703080309030A030B030C030D030E030F0310031103120313031403150316031703180319031A03"
s$=s$+"1B031C031D031E031F0320032103220323032403250326032703280329032A032B032C032D032E032F033003310332033303"
s$=s$+"3403350336033703380339033A033B033C033D033E033F0340034103420343034403450346034703480349034A034B034C03"
s$=s$+"4D034E034F0350035103520353035403550356035703580359035A035B035C035D035E035F03600361036203630364036503"
s$=s$+"66036703680369036A036B036C036D036E036F03700371037203730374037503760377030002000000004000004064000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000002000000000000000064000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0002000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"000000000000000000000000000000000000000000000000000000000000000000000000494D504900000000000000000000"
s$=s$+"0000000300000001003C40A00000000000000000000000000000000000000000000000000000000000000000000000FFFFFF"
s$=s$+"00040104020403040404050406040704080409040A040B040C040D040E040F04100411041204130414041504160417041804"
s$=s$+"19041A041B041C041D041E041F0420042104220423042404250426042704280429042A042B042C042D042E042F0430043104"
s$=s$+"320433043404350436043704380439043A043B043C043D043E043F0440044104420443044404450446044704480449044A04"
s$=s$+"4B044C044D044E044F0450045104520453045404550456045704580459045A045B045C045D045E045F046004610462046304"
s$=s$+"6404650466046704680469046A046B046C046D046E046F047004710472047304740475047604770400020000000040000040"
s$=s$+"6400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000020000000000000000640000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000020000000000000000640000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"00000000000000000000000000000000000000000000000000000000000000000000000000000000494D5049000000000000"
s$=s$+"000000000000000300000001003C40A000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"00FFFFFF00050105020503050405050506050705080509050A050B050C050D050E050F051005110512051305140515051605"
s$=s$+"1705180519051A051B051C051D051E051F0520052105220523052405250526052705280529052A052B052C052D052E052F05"
s$=s$+"30053105320533053405350536053705380539053A053B053C053D053E053F05400541054205430544054505460547054805"
s$=s$+"49054A054B054C054D054E054F0550055105520553055405550556055705580559055A055B055C055D055E055F0560056105"
s$=s$+"620563056405650566056705680569056A056B056C056D056E056F0570057105720573057405750576057705000200000000"
s$=s$+"4000004064000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000200000000000000006400000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000200000000000000006400000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000494D50490000"
s$=s$+"00000000000000000000000300000001003C40A0000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000FFFFFF00060106020603060406050606060706080609060A060B060C060D060E060F0610061106120613061406"
s$=s$+"150616061706180619061A061B061C061D061E061F0620062106220623062406250626062706280629062A062B062C062D06"
s$=s$+"2E062F0630063106320633063406350636063706380639063A063B063C063D063E063F064006410642064306440645064606"
s$=s$+"4706480649064A064B064C064D064E064F0650065106520653065406550656065706580659065A065B065C065D065E065F06"
s$=s$+"60066106620663066406650666066706680669066A066B066C066D066E066F06700671067206730674067506760677060002"
s$=s$+"0000000040000040640000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000002000000000000000064000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000002000000000000000064000000000000000000000000000000000000000000000000000000"
s$=s$+"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000494D"
s$=s$+"5049000000000000000000000000000300000001003C40A00000000000000000000000000000000000000000000000000000"
s$=s$+"000000000000000000FFFFFF00070107020703070407050706070707080709070A070B070C070D070E070F07100711071207"
s$=s$+"13071407150716071707180719071A071B071C071D071E071F0720072107220723072407250726072707280729072A072B07"
s$=s$+"2C072D072E072F0730073107320733073407350736073707380739073A073B073C073D073E073F0740074107420743074407"
s$=s$+"450746074707480749074A074B074C074D074E074F0750075107520753075407550756075707580759075A075B075C075D07"
s$=s$+"5E075F0760076107620763076407650766076707680769076A076B076C076D076E076F077007710772077307740775077607"
s$=s$+"7707000200000000400000406400000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000020000000000000000640000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"00000000000000000000000000000000070201010101FF000000020000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000494D5049000000000000000000000000000300000001003C40A000000000000000000000000000000000000000000000"
s$=s$+"00000000000000000000000000FFFFFF00080108020803080408050806080708080809080A080B080C080D080E080F081008"
s$=s$+"1108120813081408150816081708180819081A081B081C081D081E081F082008210822082308240825082608270828082908"
s$=s$+"2A082B082C082D082E082F0830083108320833083408350836083708380839083A083B083C083D083E083F08400841084208"
s$=s$+"43084408450846084708480849084A084B084C084D084E084F0850085108520853085408550856085708580859085A085B08"
s$=s$+"5C085D085E085F0860086108620863086408650866086708680869086A086B086C086D086E086F0870087108720873087408"
s$=s$+"7508760877080002000000004000004064000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000006400"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000070201010101020000000200000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"000000000000494D5049000000000000000000000000000300000001003C40A0000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000FFFFFF00090109020903090409050906090709080909090A090B090C090D090E09"
s$=s$+"0F0910091109120913091409150916091709180919091A091B091C091D091E091F0920092109220923092409250926092709"
s$=s$+"280929092A092B092C092D092E092F0930093109320933093409350936093709380939093A093B093C093D093E093F094009"
s$=s$+"4109420943094409450946094709480949094A094B094C094D094E094F095009510952095309540955095609570958095909"
s$=s$+"5A095B095C095D095E095F0960096109620963096409650966096709680969096A096B096C096D096E096F09700971097209"
s$=s$+"7309740975097609770900020000000040000040640000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000"
s$=s$+"0000640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"000000000000000000000000000000000000000000000000070201010101FE00000003000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"00000000000000000000494D5049000000000000000000000000000000000000003C80A00000000000000000000000000000"
s$=s$+"000000000000000000000000000000000000000000FFFFFF00000100020003000400050006000700080009000A000B000C00"
s$=s$+"0D000E000F0010001100120013001400150016001700180019001A001B001C001D001E001F00200021002200230024002500"
s$=s$+"26002700280029002A002B002C002D002E002F0030003100320033003400350036003700380039003A003B003C003D003E00"
s$=s$+"3F0040004100420043004400450046004700480049004A004B004C004D004E004F0050005100520053005400550056005700"
s$=s$+"580059005A005B005C005D005E005F0060006100620063006400650066006700680069006A006B006C006D006E006F007000"
s$=s$+"7100720073007400750076007700000200000000400000406400000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000"
s$=s$+"0000000000006400000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000020000000000000000640000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000494D5049000000000000000000000000000300000001003C40A000000000000000000000"
s$=s$+"00000000000000000000000000000000000000000000000000FFFFFF00090109020903090409050906090709080909090A09"
s$=s$+"0B090C090D090E090F0910091109120913091409150916091709180919091A091B091C091D091E091F092009210922092309"
s$=s$+"2409250926092709280929092A092B092C092D092E092F0930093109320933093409350936093709380939093A093B093C09"
s$=s$+"3D093E093F0940094109420943094409450946094709480949094A094B094C094D094E094F09500951095209530954095509"
s$=s$+"56095709580959095A095B095C095D095E095F0960096109620963096409650966096709680969096A096B096C096D096E09"
s$=s$+"6F09700971097209730974097509760977090102000000004000000005000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0002000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000060201010101000000000300000000000000"
s$=s$+"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s$=s$+"000000000000000000000000000000000000494D505300000000000000000000560000400940000000000000000000000000"
s$=s$+"000000000000000000000000000001008A0400000000000000000000803E000000000000000000000F39000000000000494D"
s$=s$+"50530000000000000000004156000040094000000000000000000000000000000000000000000000000000000100E6020000"
s$=s$+"0000000000000000225600000000000000000000EF39000000000000494D5053000000000000000000000000004009400000"
s$=s$+"0000000000000000000000000000000000000000000000000100680900000000000000000000803E00000000000000000000"
s$=s$+"AD3C000000000000494D50530000000000000000000056000040194000000000000000000000000000000000000000000000"
s$=s$+"000000000100200000000000000020000000D841000000000000000000004344000000000000494D50530000000000000000"
s$=s$+"000056000040194000000000000000000000000000000000000000000000000000000100200000000000000020000000B041"
s$=s$+"000000000000000000005244000000000000494D505300000000000000000000560000401940000000000000000000000000"
s$=s$+"000000000000000000000000000001002000000000000000200000009241000000000000000000007344000000000000494D"
s$=s$+"5053000000000000000000005600004019400000000000000000000000000000000000000000000000000000010020000000"
s$=s$+"0000000020000000C441000000000000000000009444000000000000494D5053000000000000000056005600004019400000"
s$=s$+"0000000000000000000000000000000000000000000000000100200000000000000020000000B04100000000000000000000"
s$=s$+"B344000000000000494D50530000000000000000560056000040194000000000000000000000000000000000000000000000"
s$=s$+"0000000001002000000000000000200000007E4100000000000000000000D144000000000000680540000000000082033707"
s$=s$+"8301FF8403180586030C048801FF8901FF8B0F30061F08618F01FF9001FF9101FF9201FF94033C0196033C02008201FF8401"
s$=s$+"FF8601FF8B0C2108000082213484212486211888033704890334048B84239630008201FF830737070F8401FF8601FF8801FF"
s$=s$+"8901FF0B25008221378301FF84211C8621108B0C270872943095033C0316008201FF8361348401FF8601FF0B290800008221"
s$=s$+"348301FF84212886211C8821378921348B842B16008201FF8361378401FF8601FF8801FF8901FF0B2D008221398301FF8421"
s$=s$+"1D8621118B0C2F0883141600023B8361348401FF8601FF0B31080000023C8301FF84212986211D8821398921358B84331600"
s$=s$+"8361398401FF8601FF8801FF8901FF0B35000237033B84211C8621100B3714953016008201FF033C8401FF8601FF0B390082"
s$=s$+"213484212886211C8821378921340B3B16008201FF03378401FF8601FF8801FF8901FF0B3D008221398301FF84211A86210E"
s$=s$+"8B252940141600023B8361348401FF8601FF8B212B00023C8301FF84212686211A8821398921350B2D16008201FF83613984"
s$=s$+"01FF8601FF8801FF8901FF8B01FF00822137033B84211C8621108B212B141516008201FF033C8401FF8601FF8B01FF008221"
s$=s$+"348301FF84212886211C8821378921348B212816008361378401FF8601FF8801FF8901FF8B01FF0002358301FF84211D8621"
s$=s$+"118B212914160002348361348401FF8601FF0B2800023284212986211D8821398921350B2616008201FF03358401FF8601FF"
s$=s$+"8801FF8901FF8B01FF0082212B033484211F8621138B212B141516008208088303328401FF8601FF8B080862000208008301"
s$=s$+"FF84212B86211F88213B8921370B08001600828083612B8401FF8601FF8801FF8901FF8B800082252E408308088384211B86"
s$=s$+"210F88213A8B25371F8D034608141600820C3F08610308008401FF8601FF08378D01FF00023D0800838084212786211B0833"
s$=s$+"89253A1F8B0808838D2143160082843B83612E8401FF8601FF082E8961370B08008D01FF00023A8348086184212286211608"
s$=s$+"3A09338B808D214614151600820C380872830C0E08008401FF8601FF0837092E0B8D01FF000236080083C084212E86212208"
s$=s$+"33093A0B8D21431600828434038401FF8601FF082E09370B8D01FF000233830C0D087284211B86210F083809338B61388D21"
s$=s$+"44141600820C310883030C08008401FF8601FF0835092E8B0808830D4600022F080083C084212786211B082E09380B08000D"
s$=s$+"48160082842D038401FF8601FF082C09358B808D01FF00022C83480883842122862116083A092E8B61378D21461415160082"
s$=s$+"0C2A0872830C0B08008401FF8601FF0837092C8B0808838D01FF000228080083840A84212E8621220833093A0B08008D2143"
s$=s$+"160082842683C08401FF8601FF082E09378B808D01FF000225830C09087284211B86210F083809338B61388D214414160082"
s$=s$+"0C230861834808008401FF8601FF0835092E8B0808830D46000221080083840884212786211B082E09380B08000D48160082"
s$=s$+"841F83C08401FF8601FF082C09358B808D01FF00021E83480861842122862116083A092E8B61378D214614151600021C830C"
s$=s$+"0708008401FF8601FF0837092C8B0808838D01FF00021A83C084212E8621220833093A0B08008D2143160002198384068401"
s$=s$+"FF8601FF082E09378B808D01FF00021783C084211D862111083509338B61358D21441416000215838405041F06130838092E"
s$=s$+"8B0808830D4300021383C004200614083C09350B08000D41160002128384048401FF8601FF083F09388B808D01FF00021083"
s$=s$+"C0842122862116083E093C8B613A8D213A14151600020E038401FF8601FF083A093F8D08088300020C838403842123862117"
s$=s$+"0835093E0B3B8D293B08001600020A03028401FF8601FF0832093A8D80007E05400000000000820343078301FF8403180586"
s$=s$+"030C048801FF8901FF8B0F30061F08618D0B3C08088494033C0196033C02008201FF8401FF8601FF8B0C2108008D08080000"
s$=s$+"82214084212486211888033704890334048B84238D01FF9630008201FF830743070F8401FF8601FF8801FF8901FF0B250082"
s$=s$+"21438301FF84211C8621108B0C270872943095033C0316008201FF8361408401FF8601FF0B290800008221408301FF842128"
s$=s$+"86211C8821378921348B842B16008201FF8361438401FF8601FF8801FF8901FF0B2D008221458301FF84211D8621118B0C2F"
s$=s$+"088314160002478361408401FF8601FF0B3108000002488301FF84212986211D8821398921358B843316008361458401FF86"
s$=s$+"01FF8801FF8901FF0B35000243034784211C8621100B3714953016008201FF03488401FF8601FF0B39008221408421288621"
s$=s$+"1C8821378921340B3B16008201FF03438401FF8601FF8801FF8901FF0B3D008221458301FF84211A86210E8B252940141600"
s$=s$+"02478361408401FF8601FF8B212B0002488301FF84212686211A8821398921350B2D16008201FF8361458401FF8601FF8801"
s$=s$+"FF8901FF8B01FF00822143034784211C8621108B212B141516008201FF03488401FF8601FF8B01FF008221408301FF842128"
s$=s$+"86211C8821378921348B212816008361438401FF8601FF8801FF8901FF8B01FF0002418301FF84211D8621118B2129141600"
s$=s$+"02408361408401FF8601FF0B2800023E84212986211D8821398921350B2616008201FF03418401FF8601FF8801FF8901FF8B"
s$=s$+"01FF00822137034084211F8621138B212B1415160082080883033E8401FF8601FF8B080862000208008301FF84212B86211F"
s$=s$+"88213B8921370B0800160082808361378401FF8601FF8801FF8901FF8B8000822533408308088384211B86210F88213A8B25"
s$=s$+"371F8D2146141600820C3F08610308008401FF8601FF08378D01FF00023D0800838084212786211B083389253A1F8B080883"
s$=s$+"8D2143160082843B8361338401FF8601FF082E8961370B08008D01FF00023A83480861842122862116083A09338B808D2146"
s$=s$+"14151600820C380872830C0E08008401FF8601FF0837092E0B8D01FF00823C36080083C084212E8621220833093A0B8D2143"
s$=s$+"160082B434038401FF8601FF082E09370B8D01FF0082A53A33830C0D087284211B86210F083809338B61388D214414160082"
s$=s$+"0C310883833C0C08008401FF8601FF0835092E8B0808830D4600022F080083F084212786211B082E09380B08000D48160082"
s$=s$+"842D83E13A8401FF8601FF082C09358B808D01FF00022C83480883842122862116083A092E8B61378D214614151600820C2A"
s$=s$+"0872830C0B08008401FF8601FF0837092C8B0808838D01FF000228080083840A84212E8621220833093A0B08008D21431600"
s$=s$+"82842683C08401FF8601FF082E09378B808D01FF0082A53525830C09087284211B86210F083809338B61388D214414160082"
s$=s$+"0C230861834808008401FF8601FF0835092E8B0808830D46000221080083840884212786211B082E09380B08000D48160082"
s$=s$+"841F83E1358401FF8601FF082C09358B808D01FF0082A5331E83480861842122862116083A092E8B61378D21461415160082"
s$=s$+"841C830C0708008401FF8601FF0837092C8B0808838D01FF00021A83C084212E8621220833093A0B08008D21431600021983"
s$=s$+"A533068401FF8601FF082E09378B808D01FF0082A5351783C084211D862111083509338B61358D2144141600828415838405"
s$=s$+"041F06130838092E8B0808830D4300021383C004200614083C09350B08000D411600021283A535048401FF8601FF083F0938"
s$=s$+"8B808D01FF0082A52E1083C0842122862116083E093C8B613A8D213A1415160082840E038401FF8601FF083A093F8D080883"
s$=s$+"00020C8384038421238621170835093E0B3B8D293B08001600020A83A52E028401FF8601FF0832093A8D8000480440000000"
s$=s$+"0000820330078403180586030C0488033704890330048B0733062D8D0B3C08088494033C0196033C02008401FF8601FF8801"
s$=s$+"FF8901FF8D08080000820808838421248621188B61308D01FF963000020800830730070F8401FF8601FF8B041F0082213C84"
s$=s$+"211B86210F8821378921308B0C160851943095033C031600830808838801FF8901FF0B0F08000082080883030800041D0611"
s$=s$+"8B080862160002080083613C0B08000082213A041E06128821378921300B0873141600830808838801FF8901FF0B08000002"
s$=s$+"37030800041F06130B0884160083613A8401FF8601FF0B080000023584211386291F08838821378921300B08731495301600"
s$=s$+"8201FF0337860808008801FF8901FF0B080000822137041686A1220B086216008201FF03358401FF8681FF0B080000822135"
s$=s$+"8301FF84211886210C8821378921308B25332D1416008361378401FF8601FF8801FF8901FF0002308301FF8421248621188B"
s$=s$+"613016008201FF8361358401FF8601FF8B041F0082212E84211B86210F8821378921308B0C1608511415160003308801FF89"
s$=s$+"01FF0B0F08000002308301FF041D06118B080862160083612E0B08000082080861041E06128821378921300B087314160002"
s$=s$+"080003308801FF8901FF0B080000020872041F06130B08841600020800830808618401FF8601FF0B08000002088303080084"
s$=s$+"211386291F08838821378921300B087314151600020800030872860808008801FF8901FF0B080000020872030800041686A1"
s$=s$+"220B086216000208000308838401FF8681FF0B08000082213303080084211886210C8821378921308B25332D141600030872"
s$=s$+"8401FF8601FF8801FF8901FF0002300308008421248621188B613016008201FF8361338401FF8601FF8B041F008221358421"
s$=s$+"1B86210F8821378921308B0C1608518D294806F28E0B3C0805F21415160003308801FF8901FF0B0F08008D01FF8E01FF0002"
s$=s$+"308301FF041D06118B0808628DA548168EA53C1616008201FF8361350B08008D01FF8E01FF00822136041E06128821378921"
s$=s$+"300B08738DA5480F8EA53C0F14160003308801FF8901FF0B08008D01FF8E01FF0002358301FF041F06130B088416008201FF"
s$=s$+"8361368401FF8601FF0B08000082213684211386291F08838821378921300B0873141516000335860808008801FF8901FF0B"
s$=s$+"08000002358301FF041686A1220B086216008201FF8361368401FF8681FF0B08000082213384211886210C8821378921308B"
s$=s$+"252E1F14160003358401FF8601FF8801FF8901FF008301FF84212486211816008361338401FF8601FF000237842120862114"
s$=s$+"8821378921308B69300851141516008801FF8901FF8B08080000042C06200B0862160003370B080000023A041D0611882135"
s$=s$+"89212E8B693508731416008801FF8901FF8B080800000429061D0B08841600033A8401FF8601FF0B080000023B84211A8621"
s$=s$+"0E88213789212F8B69370873141516008801FF8901FF8B080800000426061A0B08621600033B8401FF8601FF0B080000CB05"
s$=s$+"40000000000082072B072D830724072D8403180586030C0488033704890330048B0733062D8D033C088F073F091F94033C01"
s$=s$+"96033C02008201FF8301FF8401FF8601FF8801FF8901FF008421248621188B61308D0808838F0808839630008401FF8601FF"
s$=s$+"8B041F0D08008E073C080F0F08000082612D83612484211B86210F8821378921308B0C1608518D21488F614B943095033C03"
s$=s$+"16008201FF8301FF8801FF8901FF0B0F08008E08088300041D06118B0808628D0808830E08008F08088316000B08000D0800"
s$=s$+"8E61480F08000082612E836124041E06128821378921300B08738D21468F614A1416008201FF8301FF8801FF8901FF0B0800"
s$=s$+"8E08088300826130041F06130B08840D430E08000F4616008201FF8401FF8601FF0B08008E61460082612D83612484211386"
s$=s$+"291F08838821378921300B08730D410F4314953016008201FF8301FF860808008801FF8901FF0B08008D01FF0E438F01FF00"
s$=s$+"041686A1220B08628D21438F614616008401FF8681FF0B08008D01FF0E418F01FF0082612B83612484211886210C88213789"
s$=s$+"21308B25332D8D21418E01FF8F614A1416008201FF8301FF8401FF8601FF8801FF8901FF8E6143008421248621188B61300D"
s$=s$+"3C8E01FF0F4816008401FF8601FF8B041F8D01FF8E61418F01FF0082612D83612484211B86210F8821378921308B0C160851"
s$=s$+"8D213A8F6141141516008201FF8301FF8801FF8901FF0B0F08000E3C00041D06118B0808620D3C8E01FF0F4316000B08008E"
s$=s$+"613A0082612E836124041E06128821378921300B08738D0808618F0808611416008201FF8301FF8801FF8901FF0B08000D08"
s$=s$+"000E3C0F080000826130041F06130B08840D08720F087216008201FF8401FF8601FF0B08000D08008E0808610F0800008261"
s$=s$+"2D83612484211386291F08838821378921300B08730D08830E08000F0883141516008201FF8301FF860808008801FF8901FF"
s$=s$+"0B08000D08000E08720F080000041686A1220B08620D08720E08000F087216008401FF8681FF0B08000D08000E08830F0800"
s$=s$+"0082612B83612484211886210C8821378921308B25332D8D213F0E08008F613C1416008201FF8301FF8401FF8601FF8801FF"
s$=s$+"8901FF0E0872008421248621188B61300D3C0E08000F3716008401FF8601FF8B041F8D01FF8E613F8F01FF0082612D836124"
s$=s$+"84211B86210F8821378921308B0C1608518D21418F613E141516008201FF8301FF8801FF8901FF0B0F08000E3C00041D0611"
s$=s$+"8B0808620D3C8E01FF0F3716000B08008D01FF8E61418F01FF0082612E836124041E06128821378921300B08738D21428F61"
s$=s$+"3F1416008201FF8301FF8801FF8901FF0B08000E3C00826130041F06130B08840D418E01FF0F3E16008201FF8401FF8601FF"
s$=s$+"0B08008D01FF8E61428F01FF0082612D83612484211386291F08838821378921300B08738D21428F613F141516008201FF83"
s$=s$+"01FF860808008801FF8901FF0B08000E4100041686A1220B08620D418E01FF0F3E16008401FF8681FF0B08008D01FF8E6142"
s$=s$+"8F01FF0082612B83612484211886210C8821378921308B252E1F8D213F8F61431416008201FF8301FF8401FF8601FF8801FF"
s$=s$+"8901FF8D0808830E418F080883008421248621180D08008E01FF0F080016008401FF8601FF8D808E613F8F80008261338361"
s$=s$+"2B8421208621148821378921308B693008518D21438E0808838F6146141516008201FF8301FF8801FF8901FF8B0808008D08"
s$=s$+"08830E08008F08088300042C06200B08620D08008E800F080016000B08008D808E61438F800082613583612C041D06118821"
s$=s$+"3589212E8B693508738D21468E0808838F61481416008201FF8301FF8801FF8901FF8B0808008D0808830E08008F08088300"
s$=s$+"8261360429061D0B08840D08008E800F080016008201FF8401FF8601FF0B08008D808E61468F800082613783612B84211A86"
s$=s$+"210E88213789212F8B693708738D21478E0808838F614F141516008201FF8301FF8801FF8901FF8B0808008D0808830E0800"
s$=s$+"8F080883000426061A0B08620D08008E800F080016008401FF8601FF0B08008D808E61478F80000C08400000000000820337"
s$=s$+"078403200586031404880733042D89072C042D8B0333068D0348088E0B3C0805F28F07300B2D900F320B2D13D394033C0196"
s$=s$+"033C0200820808838401FF8601FF8801FF8901FF8B0808518E042D8F6133906937130096340A000208008421208621148861"
s$=s$+"3389612C0B08008D042D0E1F0F3C90E13E963000828083073707168401FF8601FF8801FF8901FF0B08620D1F0E160F3F1043"
s$=s$+"9107300B0F920F320B0F13D396340F00028308088384212086211488613389612C0B08008D294306F28E294F05E20F48104A"
s$=s$+"9161339269371300943095033C03963000020308008401FF8601FF8801FF8901FF0B08738D01FF8E01FF0F4B104F113C92E1"
s$=s$+"3E9634160082213E838084212086211488613389612C0B08008DA543168EE14F0F541056113F12439630008280038401FF86"
s$=s$+"01FF8801FF8901FF0B08848D01FF8E01FF0F57105B1148124A96340F00020384212086211488613389612C0B08008DA5430F"
s$=s$+"8EA54F0F0F6090F0114B124F1496300082213C83613E8401FF8601FF8801FF8901FF0B08738D01FF8E01FF0F5790E1561154"
s$=s$+"125696340A008280838084212086211488613389612C0B08000F54104F1157125B96300002038401FF8601FF8801FF8901FF"
s$=s$+"0B08620F4B104A116092F096340F0082213783613C84212086211488613389612C8B09FF08000F481043115792E156149530"
s$=s$+"963000828083808401FF8601FF8801FF8901FF0F3F103E1154124F963416008221350384211E86211288613189612A8B2135"
s$=s$+"0F3C1037114B124A96300082808361378401FF8601FF8801FF8901FF8B0808510F3310321148124396340F0002838084211E"
s$=s$+"86211288613189612A0B08000F2E90693013D3113F123E1496300082213A8361358401FF8601FF8801FF8901FF0B08620F31"
s$=s$+"10351300113C123796340A0082080883838084211E86211288613189612A0B08000F3A90E13C113312329630000208000384"
s$=s$+"01FF8601FF8801FF8901FF0B08730F3D1041112E92693013D396340F00828083613A84211E86211288613189612A0B08000F"
s$=s$+"461048113112351300141596300002830808838401FF8601FF8801FF8901FF0B08840F49104D113A92E13C96341600020308"
s$=s$+"0084211E86211288613189612A0B08000F521054113D12419630000283808401FF8601FF8801FF8901FF0B08730F55105911"
s$=s$+"46124896340F008221310384211E86211288613189612A0B08000F5E90F01149124D149630000233038401FF8601FF8801FF"
s$=s$+"8901FF0B08620F5590E1541152125496340A0002350384211E86211288613189612A8B09FF08000F52104D11551259963000"
s$=s$+"02388361318401FF8601FF8801FF8901FF0F491048115E92F096340F00023A033384211E86211288613189612A0F46104111"
s$=s$+"5592E1541415963000023C03358401FF8601FF8801FF8901FF0F3D103C1152124D963416000242033884211C86211088612F"
s$=s$+"8961288B21360F3A103511491248963000033A8401FF8601FF8801FF8901FF8B0808510F3110301146124196340F00033C84"
s$=s$+"211C86211088612F8961280B08000F2C90692E13D3113D123C149630008208088303428401FF8601FF8801FF8901FF0B0862"
s$=s$+"0F2F10331300113A123596340A0002080084211C86211088612F8961280B08000F3890E13A1131123096300082808401FF86"
s$=s$+"01FF8801FF8901FF0B08730F3B103F112C92692E13D396340F00028308088384211C86211088612F8961280B08000F441046"
s$=s$+"112F123313001415963000020308008401FF8601FF8801FF8901FF0B08840F47104B113892E13A9634160082213F83808421"
s$=s$+"1C86211088612F8961280B08000F501052113B123F9630008280038401FF8601FF8801FF8901FF0B08730F53105711441246"
s$=s$+"96340F00020384211C86211088612F8961280B08000F5C90F01147124B1496300082213B83613F8401FF8601FF8801FF8901"
s$=s$+"FF0B08620F5390E1521150125296340A008280838084211C86211088612F8961288B09FF08000F50104B1153125796300002"
s$=s$+"038401FF8601FF8801FF8901FF0F471046115C92F096340F0082213883613B84211C86211088612F8961280F44103F115392"
s$=s$+"E152141596300083808401FF8601FF8801FF8901FF0F3B103A1150124B9634160002340384211A86210E88612D8961268B21"
s$=s$+"370F3810331147124614159630008201FF8361388401FF8601FF8801FF8901FF8B0808510F2F102E1144123F96340F008221"
s$=s$+"3584211A86210E88612D8961260B08008F033E099001FF113B123A96300003348401FF8601FF8801FF8901FF0B0862113812"
s$=s$+"330002378301FF84211A86210E88612D8961260B08008F2140112F122E141516008201FF8361358401FF8601FF8801FF8901"
s$=s$+"FF0B087390073E090F9201FF0082213984211A86210E88612D8961260B08000F4191073E090A141516008201FF03378401FF"
s$=s$+"8601FF8801FF8901FF0B0884906140008221438301FF84211F86211388612B8961320B08000F4391614092073E0901160082"
s$=s$+"0808618361398401FF8601FF8801FF8901FF0B08731041000208008301FF84211F86211388612B8961320B08008F08088311"
s$=s$+"419261401416000208728361438401FF8601FF8801FF8901FF0B08620F08001043000208008308086184212186211588612D"
s$=s$+"8961328B09FF08008F80114312411516000208830308008401FF8601FF8801FF8901FF0F9008087315000208000308728421"
s$=s$+"2286211688612E8961340F100800910808831243141516000208940308008401FF8601FF8801FF8901FF0F90801108000002"
s$=s$+"080003088384212386211788612F8961350F109180920808731516000208830308008401FF8601FF8801FF8901FF8F81FF90"
s$=s$+"81FF1112080000DE000001000000005669E3D15BA5857B2359017C00000040062B080000277B800080FB01E80BC287000017"
s$=s$+"264C0000D334CE420000A8D74700002AF2211E01004A110000A626000014230000142300008C4F0000181300C6040000009C"
s$=s$+"BF10000000000000000080FBEC43000000000000000000172A040000000000000000C021010100A8600400000000000050CD"
s$=s$+"0800000000000000000080FB080200000000000000000040E923000000000000000000005421000000000000000000000028"
s$=s$+"7E0400000000000000000000807A43000000000000D3130000000000C40200BC02010BF455387084D368D8F8C6304FC52F76"
s$=s$+"3ED76DC0D9A0A08359E2289A70FEF5A34FC314EA5BC0828584442E387AD0A5EF00F26009355BA459CE69820746CC3302881C"
s$=s$+"4FC08B7C956E4BC043D629344E9B96AF4C054F793947F0BF92A4433F070D3BDAA14A83B225F297B76453B67F96B1844B8421"
s$=s$+"02CE9D52877E0569D9D13A8605BBA897AF702D54EA1529563032689DB98C77CA9A9273A839616F894AACA006AD3173E2AEB2"
s$=s$+"477A486C854FB653AC82B4EAABD97A9BB8D3CDFDA5140EED72D4BF489FBF64CF3D6EA013F1167CF01FB48F242BC95AA15AED"
s$=s$+"BE549F943B4CF353CDCE30A3A10AE2A2E80F225164518554B782058C402D6A53F257E119E5136D3E4D47320343F50F739227"
s$=s$+"49FCD1F6F78BBDF7BE926A8B370BBA4B7094E8C382FA53EFCF2D14AADA70CAEC0F350301B8D1EB50B1507BF7853945C4CFA1"
s$=s$+"6162477850B8C23E36CB8178FC502C97690BBA5F0D5A67BDA4B32ED1887C423AA027DF801D64B70AB4A1FF247B5F6798CA55"
s$=s$+"86FA8D912AB53F2630DC94515624B57A015F2BB3F47A01012AE92F05FC6C01AB0D224F3B1CC2C3EAC5E382157D29E093D7C1"
s$=s$+"36910BF9067C12772D3565CF9A140D762A15C4FC840BC034063A35B05D4A772D039918D86DD09AFB88E6051EECCBCAA2BE8A"
s$=s$+"9EB747DACA8EC490B6A66C635EC695F6684CCAB69CC21E6390405C05281F809189A5BDFC9F87CCE48BA90FE639CA2190FF7E"
s$=s$+"33D7CFAAC246CC2A2A452D0AA6054EA916E999A0717C055D5F93B674655133E88F15438FD841D20F507F442D7AD641BE507E"
s$=s$+"DCFF9BBD8EEA17C344E3CEBB039CF9EC604B48D499D1BE358309FD8944FFA45EDAB4A065927F8C2DD04BB2550065E4A54D9E"
s$=s$+"1896901BFEC320C55A7CDB0E1921FA5AC50F4F4F3A0A96D435E425FE8E56700F89376B5295C2C690853EBD822A2F2C0B4177"
s$=s$+"CC19F169BA3A87CE7EFEE15DD89B82EB9B40BD296839F02FA5D2376C86EB37980194070201E1C103D32D527C000000B424FB"
s$=s$+"1FC5C70780630080E2D2FC06FCEE88087C0000C0FF0B708F0FC14772F93FFCE02100233CB80A1AE8870F000080F7E32F41BF"
s$=s$+"80743C00E004F8E187B019749D1F2C020000D0F371237FBDD6101F8E0094C007382DA0A958FC05F800008038DF67E079BCF4"
s$=s$+"007A9DAE63B1CED4AAFF800E8F62F7BA8299F056CA552AF12E117F2D3290087A8E4C40E3C927D6450200F52EC9F4230C063A"
s$=s$+"58A057ADDA4F582810F79F50BD22DC33E8A74E037E7C0C2DA257C007303D840655FAC7A6CFC1AF4E848279883B67E10E692A"
s$=s$+"56801A2680FD44F544C5413FBF84A8DBB407201F278704617E08FCEA61C8CFC1F64784A617F0D52B50B8857D70143A46FFC1"
s$=s$+"40FD041D240420E8417D340078477CF3DC119E4A513499B2036CFEC0DB1190EC06004F62F428E0731040D7F9C2C892220EA0"
s$=s$+"1F1D63D0CFC1C2C23C01EFDA0BECB3D108F5BCC9B6C288323D45DCA4D669241C003A08FE0083BCBA45592780BC05013DBB03"
s$=s$+"1E69B6048041417E06F559266D0C80407C0E827ED72719B10740E0151446764CF117FEE31DFC632E7D28771468A3608645B3"
s$=s$+"78E6AFE08FBB19E2713E5CA9AAF3EB24F3130C5190C6A59EF00E05CBB8F0578E000A8931F45CFF681AC062014CF09EFE016A"
s$=s$+"D4C0C1AB3809D5E0A030A7A07C5243502C0E0DACEDE700345AF1F353C831B35F44B7AD2E81AAEDF7BBAECB61CEF3388F412E"
s$=s$+"9110E442292A28707F6889A2286F2C095F03C059A234DBFD652DFA548D70EDF3C4C930A029B85F1F01A5A61769BBD96A3121"
s$=s$+"002D6010D01F7EA8204C91A4E541024107EBC6F54728F7D33ECD1E8D84F5F3E8C379F1ED4DD2AD2A043CB18AC70BD8CB082C"
s$=s$+"7F72E9E44FFDA90618A68B3B9E08D2130E36CD1C10E382CBF5E7C77C8D0808A742422FB22C01469E8A516E911216CD00D117"
s$=s$+"F085F660CA02E1D11A52F502053A38E070B49F2A60A41FBCB4DC51F1172CF0E8D590FC9C6E6FBF4874503EF04E3312B4F8FF"
s$=s$+"8FC0432D7F404A89314BBEF091FF30C80AACDF4AE32443C11BF8AF87C4F618F72705EB4FA4BF380BD054DC1205F412D9AA4C"
s$=s$+"2C10C8DE5CE8D673C0046BBCE4FA74A30CFF24C324B80234DDFAED1FCD03B8F880CEF5E1F5DB6899095B812859851ED920C0"
s$=s$+"F5C5819635FA17DE272A9EE777925D7A8720B025FA2DA2352812CE5F1A068CA2424BF133D718D41A7D770F1D904B0BAD47FB"
s$=s$+"272DE314CB040B9E3EF584D42CF057DCC2A558027E2562F58B011ADF28D6A3E7946041C24D8D25F83D72BC50899E7A453DB9"
s$=s$+"269BDF29BF3F79DE895F1643C62096E8CF3E0C8D5D915020FBA4DB8F0F920EB02103FB3F142CA8885FF8A62D29B0345D0900"
s$=s$+"56351F3B78E12D29AAFB42778EB300D2F00758C6AAF08A30400232E9DE594FE28A0BEEAFD8BC972580EDB2A429A95DF777C6"
s$=s$+"A4FC004603F817A8769A5202FAC2FDB4FCDC3BFBD1079A1A069E7B0679A75B1DE59947F09EED0318242A613FE3B3C798CE99"
s$=s$+"629DD9BF2281212960615BFDAAE38CF379ECF29FDB87D7250BB106049209000BDD95BB32301CD08F3D538CB15AB6FC93C808"
s$=s$+"D56F23B04D9A3DEB7FF5A100199344394BFC8EF8816AF91C01AFE680C07273BE9AC01565CC01A0B0E3E941F5B52CECE0FC7B"
s$=s$+"26DEC936877F57E48F8174CFC721052E6366A44F8B90324073B5F00B9A0AB9280898DCA96775DB19760A8015F5E990AEE8D7"
s$=s$+"3C22D8B35E11178D0900BD87C786256F4ADB2F0AFE6DB4DE01A015BF9E6E425B570958B0E0038C6C231F8075B05E2000BC5D"
s$=s$+"D060DDA1E0200643BE043458519FDE28FF38E0911035EAC127F67F04FD42CC8CDF481DF6A9BD59380C19A8592CB852AF7C41"
s$=s$+"753720F4AEF7FB7D5110582DB51A9518EC2818C0AEE02FD45825B5C28305372AE606A50BE8F884932B45AC13B09F407672F1"
s$=s$+"ABB15A5F84806381E506228DF02898E70A9BA152607A60BBBF00C692BCC1A459836FFC3BB0DFA0E4901F80560058EEE30208"
s$=s$+"8782FBD848FB312BA1E580ED063D9E1C06C85E78581282D46AFB0BA80DF84A41161780960F12FE2FBFBE990460299040C815"
s$=s$+"805590EEA44A6FA13B329838484E2A4847FFD146434EA8B243F72DFC870EB5D8CCCC77734768C20380E5B38D3CB50240FD40"
s$=s$+"7DFFFF253380AA307020A520416A93816D20D32A3F5A40C97D2ABDD662AAE709A49E3F2805C064014FC420613E7A257C01F5"
s$=s$+"E0225301B11D1A04D2FADF5E4AA718B0407610285E3335009916FF049C1938872EA41B05426AC53960A9CB3DA10CD34E6CA1"
s$=s$+"432F44BCFE5FB5606E8981AC41BAE82880C4F017A4BA00806102B06051500CA8E98BBB36F1A12E4BB8D14A1F3A3E00A0E800"
s$=s$+"98F500988CF2AA6A6B650300638B7401BAA168912E0A75651E18E649D4803CB907A30042050094ADA850C002B283405E80B0"
s$=s$+"33EA06DCC183AAC2A3C1730AF96014E8E223D40052A06607C63112C0633302A8EA12033C06297B91784E7FD41402659B5865"
s$=s$+"8D56F4EC6443F8069B3D84A90100550348B6599F2AAB097F8136075F7C950F00B7938F3A56186EDEC1B440ED034281428D3D"
s$=s$+"28004065B8621F8C8547007C7E4700561C2C8B6714A2144066AB474D0D406D1150C4A6401B600A50C0A4A7C405CFD201F0A6"
s$=s$+"15FB10400B05EDE2B5F6C0053AFE96D505ED501A30E202DEB550A0E4A45010E00D322FDC060B0579CFC602016ABFA6216D6A"
s$=s$+"CF60FBF16F1FB0F55BC2FFA5241F00001A145A0C50008B00000D000161AD17C00700B4611F0B00001F00776A7DF255F0D9AC"
s$=s$+"ADDBAA0AA46B670CCF778CD0EDE4ECD7EDE1F4F76382361F00060D7A653900A2F1651EC0172A80CC3A90F792080F883C7FB8"
s$=s$+"9035708CA70F1D007D7A1D034664171174EEDA11ACD7E6ACB7EEC31073904A09B60299EC001C00668C79AB37EF1D3C7BF7F0"
s$=s$+"0DD4DDEE7691A9B1C32A0E8887233290011D00810C96FA223F28E853C9656CC30744411BC4F15BAB38BA937E1880ED02"


part 2

added are sfx, for the rest no changes..

	l=Len(s$)
	ibank=CreateBank(l/2)
	For t=0 To (l/2)-1
		m$=Mid$(s$,1+t*2+0,1)
		p=(Instr(h$,m$)-1)*16
		m$=Mid$(s$,1+t*2+1,1)
		p=p+(Instr(h$,m$)-1)
		PokeByte ibank,t,p
	Next

	time$=Replace$(CurrentTime$(),":","")
	itfile$="CS_TBL"+time$+".IT"
	fileout=WriteFile(itfile$)
	If fileout
		For t=0 To BankSize(ibank)-1
			WriteByte fileout,PeekByte(ibank,t)
		Next
	Else
		skip=True
	EndIf
	CloseFile fileout
	FreeBank ibank


s$=   "524946465201000057415645666D7420100000000100010000080000000800000100080064617461D80000008EDBFDFFFBF8"
s$=s$+"FAFDF8D88929063B9CF5B8183ED8BF1086E72286D411D95D73B53CCC3BC14BAF5CA06A9375897E8382808380828281838083"
s$=s$+"81828280847F848081847A8C719667A05DA954B051AE5C978067B43BC85087AA3ABC774FC56656C27348B19E4378BF81427C"
s$=s$+"BA984C5794B9995A4B6B98B3AC89624E5061788D9EAAB0B2B1AFADACACADAFB0B0ADA69987725E52556D92ACA98A64526EA1"
s$=s$+"A9805667A2A1685A98A26266A88556989556949257A17C67A85B957F6F9C5EA162996C8F738A778879877A857B837D817F80"
s$=s$+"807F80808080808080804C4953544E000000494E464F494352440B000000323030352D31322D3031000049454E4707000000"
s$=s$+"426F6F7220200000495346541E000000536F6E696320466F756E64727920536F756E6420466F72676520352E3000"

	l=Len(s$)
	ibank=CreateBank(l/2)
	For t=0 To (l/2)-1
		m$=Mid$(s$,1+t*2+0,1)
		p=(Instr(h$,m$)-1)*16
		m$=Mid$(s$,1+t*2+1,1)
		p=p+(Instr(h$,m$)-1)
		PokeByte ibank,t,p
	Next
	wavfile$="CS_TBLSFX1"+time$+".WAV"
	fileout=WriteFile(wavfile$)
	If fileout
		For t=0 To BankSize(ibank)-1
			WriteByte fileout,PeekByte(ibank,t)
		Next
	EndIf
	CloseFile fileout
	FreeBank ibank

s$=   "524946460E02000057415645666D7420100000000100010000080000000800000100080064617461940100009DA73B1B012A"
s$=s$+"4DB87D2C0D0E3376BB4E2502203D9E9F3519042F55BC762D0D113579BC4E24032746AF842F1013388CAB441F072D5CBA6328"
s$=s$+"082544A4902F150D356EBC58200A2B59B965270B1D3FAC8431150F3572C05C2C0E2B4FAC8B3A18284B9B9E4024264BA38E32"
s$=s$+"213D5CAC8D3F2A3358B57F3A2D3C63AE853C3B5CA68C4B3A52A1964A3A526BAB8D56435AA578444B649C8F4C4E6EA67B4D5B"
s$=s$+"96A16D525E8D9A685A899B735A6D98805D6276997C5F7B97937564647693856A67848D6B6F8B8B6D738A9374728E8E766C75"
s$=s$+"8B866C798F8C7A6E8192786E81917C6E7F907E6D7F8F7C7286907D6F828C76758C8772758B8A777188856F7A8A8771798B84"
s$=s$+"75738985717A8D84717C8B8B7C737A8988767B88877775848A7B73818D7F757B8A80747A8687777684897C757E8982777987"
s$=s$+"857B777D8884777A87877C787E87847A7983877D787F87837A7981877F787D85847C7B84857D7A8186807B7C83847E7B8085"
s$=s$+"817B7D83847F7C7F84827D7D82847F7C7F83837F7D7F82827E7E8182807E7F81827F7E8081817F7F8081817F7F8081804C49"
s$=s$+"53544E000000494E464F494352440B000000323030352D31322D3031000049454E4707000000426F6F722020000049534654"
s$=s$+"1E000000536F6E696320466F756E64727920536F756E6420466F72676520352E3000"

	l=Len(s$)
	ibank=CreateBank(l/2)
	For t=0 To (l/2)-1
		m$=Mid$(s$,1+t*2+0,1)
		p=(Instr(h$,m$)-1)*16
		m$=Mid$(s$,1+t*2+1,1)
		p=p+(Instr(h$,m$)-1)
		PokeByte ibank,t,p
	Next
	wavfile$="CS_TBLSFX2"+time$+".WAV"
	fileout=WriteFile(wavfile$)
	If fileout
		For t=0 To BankSize(ibank)-1
			WriteByte fileout,PeekByte(ibank,t)
		Next
	EndIf
	CloseFile fileout
	FreeBank ibank

s$=   "524946469C03000057415645666D7420100000000100010000100000001000000100080064617461210300008093A1B6DDFA"
s$=s$+"EACAA6817D614D3328231F1C1613080301080C1518262F333D44485A647495BACCF6D1B89C877D726254413D36332D2A2318"
s$=s$+"110A0C151D242F383F4A5B69797D8E93A8B5DAEBCDBAA5938A766862584D444138342C231A151D2428313A43464F5A5B646B"
s$=s$+"79838CA3BCD8D1B39A85766D665D584D4A4138312F28262321262F343844545D616F8195ACBDCFD1B89E9A8E79746F64544B"
s$=s$+"41312C2A2C33363B4146515A5D64727985939FACB5C6C1AA9C97857871625F544B44433B33343B464B5156616B7679838591"
s$=s$+"97A8B5BDC6AF9F91857D7168615D58544D463F3A3D46484B525B5F666F7D8F95A5B8BFB6AF9F9C8F887B767268625A52514A"
s$=s$+"44484D565D6B6D7478808C98A1A5AFB5AE9E8C878076726D64615D5652514B4B52585F62686F76808793979CA6B1A6A19A91"
s$=s$+"8C817F79746D68625B56545B61686B6D74767B7D83888C91959A9FA5A19A978F8E83817B7674716F6964625F5F64696D7276"
s$=s$+"797F8083858A919A9F98938E8C8A85807B78726F6F6B6868696D6F74787B7B8085888F919597978F8C878781807F7D797472"
s$=s$+"6F6B6B69696D71717478797F808185888C8E919197938E8A85817F7F7B79787472716D6B6F717276797F808387888C91938E"
s$=s$+"8A888585817F7B78767472716D6D6D717274787B7D808083878A8C8F938C888585807F7B797874716F6F717476787B7F8083"
s$=s$+"85888C8E918F8C88858381817F7D79767472716F71727676797B7F80818585888A8F8E8E8A878581817F7D79797874727272"
s$=s$+"7478797B7D7F80838387888C8E8E8C8C8888858383807F7D7D79787676727476787B7B7F7F80838387878A8C8C8887858381"
s$=s$+"807F7D797876747678797B7F808183838587888A888887858381807F7F7D7B797978767678797B7B7D7F8080818383858788"
s$=s$+"8888888785838180807F7D7B7B7B79787879797B7D7F8081818383858587878785858381818180807F7D7D7B7979797B7B7D"
s$=s$+"7F8080808181838385858585838383818080807F7F7F7D7D7D7B7B7B7D7D7F7F7F7F80808081818183838383838381818180"
s$=s$+"8080807F7F7F7D7D7D7D7F7F7F8080808080808081818181818181818181808080808080807F7F7F7F7F7F8080004C495354"
s$=s$+"4E000000494E464F494352440B000000323030352D31322D3031000049454E4707000000426F6F7220200000495346541E00"
s$=s$+"0000536F6E696320466F756E64727920536F756E6420466F72676520352E3000"

	l=Len(s$)
	ibank=CreateBank(l/2)
	For t=0 To (l/2)-1
		m$=Mid$(s$,1+t*2+0,1)
		p=(Instr(h$,m$)-1)*16
		m$=Mid$(s$,1+t*2+1,1)
		p=p+(Instr(h$,m$)-1)
		PokeByte ibank,t,p
	Next
	wavfile$="CS_TBLSFX3"+time$+".WAV"
	fileout=WriteFile(wavfile$)
	If fileout
		For t=0 To BankSize(ibank)-1
			WriteByte fileout,PeekByte(ibank,t)
		Next
	EndIf
	CloseFile fileout
	FreeBank ibank

	For t=0 To 5
		PokeByte bank,32+t,Asc(Mid$(time$,t+1,1))
	Next

	PokeInt bank,08,imgMarbles
;
	PokeInt bank,12,CreateTimer(8)
	PokeInt bank,24,CreateTimer(1)
;
	PokeByte bank,16,4 ; xpos
;
	PokeByte bank,19,1 ; block speed
;
	PokeByte bank,20,1
	PokeByte bank,21,2
	PokeByte bank,22,3
;
	PokeInt bank,28,CreateBank(8*13)

	If Not skip PlayMusic itfile$,1


	PokeInt bank,38,LoadSound("CS_TBLSFX1"+time$+".WAV")
	PokeInt bank,42,LoadSound("CS_TBLSFX2"+time$+".WAV")
	PokeInt bank,46,LoadSound("CS_TBLSFX3"+time$+".WAV")

	
	Return bank

End Function

Function PlayColumnz(bank,act$="",arg1=-1,arg2=-1,arg3=-1)

	Select act$
	Case ""
		app=PeekInt(bank,0)
		canvas=PeekInt(bank,4)
		timer=PeekInt(bank,12)
		timerauto=PeekInt(bank,24)
		xpos=PeekByte(bank,16)
		ypos=PeekByte(bank,17)
		phase=PeekByte(bank,18)
		map=PeekInt(bank,28)
		sound1=PeekInt(bank,38)
		sound2=PeekInt(bank,42)
		sound3=PeekInt(bank,46)
		SoundVolume	sound1,.3
		SoundVolume	sound2,.3
		SoundVolume	sound3,.3
		
	
		marble1=PeekByte(bank,20+ phase    Mod 3)
		marble2=PeekByte(bank,20+(phase+1) Mod 3)
		marble3=PeekByte(bank,20+(phase+2) Mod 3)
		imgMarbles=PeekInt(bank,08)
	
		update=1
	
		
		Repeat
			WaitEvent()
			If EventID()=$803
				If EventSource()=app
					quit=True
				EndIf
			EndIf
	
			If KeyDown(203)	l=True
			If KeyDown(205)	r=True
			If KeyDown(208)	d=True
			If KeyHit(57)	s=True
	
			action=0
	
			If EventID()=$4001
				If EventSource()=timer
					If l ; left
						PlaySound sound1
						l=0
						If Not PlayColumnz(bank,"col",xpos-1,ypos)
							xpos=xpos-1
							action=1
						EndIf
						dropsound=0
					EndIf
					If r ; right
						PlaySound sound1
						r=0
						If Not PlayColumnz(bank,"col",xpos+1,ypos)
							xpos=xpos+1
							;If xpos>7 xpos=7
							action=1
						EndIf
						dropsound=0
					EndIf
					If d ; down
						d=0
						If Not PlayColumnz(bank,"col",xpos,ypos+1)
							PauseTimer timerauto
							ypos=ypos+1
							If ypos>10
								xpos=4
								ypos=0
							EndIf
							action=1
							ResumeTimer timerauto
						Else
							If Not dropsound
								PlaySound sound3
								dropsound=1
							EndIf
						EndIf
					EndIf
					If s ; space
						PlaySound sound2
						s=0
						action=2
					EndIf
				EndIf
	
				Select action
					Case 1
						PokeByte bank,16,xpos
						PokeByte bank,17,ypos
						update=True
					Case 2
						phase=(phase+1) Mod 3
						marble1=PeekByte(bank,20+(phase+2) Mod 3)
						marble2=PeekByte(bank,20+(phase+1) Mod 3)
						marble3=PeekByte(bank,20+(phase+0) Mod 3)
						PokeByte bank,18,phase
						update=True
				End Select
	
				If EventSource()=timerauto
					If PlayColumnz(bank,"die") quit=True
					If PlayColumnz(bank,"col",xpos,ypos+1) ; can't go on anymore?
;						PlaySound sound3
						dropsound=0
						PokeByte map,xpos+(ypos+0)*8,marble1
						PokeByte map,xpos+(ypos+1)*8,marble2
						PokeByte map,xpos+(ypos+2)*8,marble3

						; scan for triplets and bigger
						While PlayColumnz(bank,"scan")
						Wend
						
						;
					
						xpos=4
						ypos=0
						marble1=Rnd(1,6)
						marble2=Rnd(1,6)
						marble3=Rnd(1,6)

						For y=0 To 12
							For x=0 To 7
								v=PeekByte(map,x+(y*8))
								
							Next
						Next

						

						PokeByte bank,20+(phase+2) Mod 3,marble1
						PokeByte bank,20+(phase+1) Mod 3,marble2
						PokeByte bank,20+(phase+0) Mod 3,marble3

						PokeByte bank,17,ypos
						update=True
					Else
						ypos=ypos+1
						If ypos>10
							xpos=4
							ypos=0
						EndIf
						PokeByte bank,17,ypos
						update=True
					EndIf
				EndIf
	
	
			EndIf
	
	
			If update
				update=0
				SetBuffer CanvasBuffer(canvas)
					Cls
					For y=0 To 12
						For x=0 To 7
							v=PeekByte(map,x+(y*8))
							DrawBlockRect imgMarbles,x*32,y*32,v*32,0,32,32
						Next
					Next
					
					DrawBlockRect imgMarbles,xpos*32, ypos   *32,marble1*32,0,32,32
					DrawBlockRect imgMarbles,xpos*32,(ypos+1)*32,marble2*32,0,32,32
					DrawBlockRect imgMarbles,xpos*32,(ypos+2)*32,marble3*32,0,32,32
					
				FlipCanvas canvas
			EndIf
	
	
			
		Until quit
	Case "col"
		map=PeekInt(bank,28)
		; map = 8x13
		If arg1<0 Return 1
		If arg1>7 Return 1
		If arg2>10 Return 1
		For t=0 To 2
			v=PeekByte(map,arg1+((arg2+t)*8))
			If v collision=collision+1
		Next
		If collision Return 1

	Case "die"
		map=PeekInt(bank,28)
		For t=0 To 2
			v=PeekByte(map,4+t*8)
			If v dead=1
		Next
		If dead Return 1

	Case "scan"
		DebugLog "scan!"
		map=PeekInt(bank,28)
		tmp=CreateBank(8*13)


		;
		; ooo
		;

		For mapy=0 To 12
			For mapx=0 To 7-2
				marble=PeekByte(map,mapx+(mapy*8)) ; get the startmarble
				If marble>0
					found=0
					For t=1 To 2
						If PeekByte(map,mapx+t+(mapy*8))=marble
							found=found+1
						EndIf
					Next
					If found=2 ; 3 identical pieces found!
						foundsomething=1
						For t=0 To 2 ; mark marbles for deletion
							PokeByte tmp,mapx+t+(mapy*8),1
						Next
					EndIf


				EndIf
			Next
		Next

		; o
		; o
		; o

		For mapy=0 To 12-2
			For mapx=0 To 7
				marble=PeekByte(map,mapx+(mapy*8)) ; get the startmarble
				If marble>0

					found=0
					For t=1 To 2
						If PeekByte(map,mapx+((mapy+t)*8))=marble
							found=found+1
						EndIf
					Next
					If found=2 ; 3 identical pieces found!
						foundsomething=1
						For t=0 To 2 ; mark marbles for deletion
							PokeByte tmp,mapx+((mapy+t)*8),1
						Next
					EndIf

				EndIf
			Next
		Next

		; o
		;  o
		;   o

		For mapy=0 To 12-2
			For mapx=0 To 7-2
				marble=PeekByte(map,mapx+(mapy*8)) ; get the startmarble
				If marble>0

					found=0
					For t=1 To 2
						If PeekByte(map,mapx+t+((mapy+t)*8))=marble
							found=found+1
						EndIf
					Next
					If found=2 ; 3 identical pieces found!
						foundsomething=1
						For t=0 To 2 ; mark marbles for deletion
							PokeByte tmp,mapx+t+((mapy+t)*8),1
						Next
					EndIf

				EndIf
			Next
		Next

		;   o
		;  o
		; o 

		For mapy=0 To 12-2
			For mapx=2 To 7
				marble=PeekByte(map,mapx+(mapy*8)) ; get the startmarble
				If marble>0

					found=0
					For t=1 To 2
						If PeekByte(map,mapx-t+((mapy+t)*8))=marble
							found=found+1
						EndIf
					Next
					If found=2 ; 3 identical pieces found!
						foundsomething=1
						For t=0 To 2 ; mark marbles for deletion
							PokeByte tmp,mapx-t+((mapy+t)*8),1
						Next
					EndIf

				EndIf
			Next
		Next

		
		; delete all marked marbles
		For y=0 To 12
			For x=0 To 7
				If PeekByte(tmp,x+y*8) PokeByte map,x+y*8,0
			Next
		Next
		
		; and stuff may tumble down now as well
		For x=0 To 7
			c$=""
			For y=0 To 12
				c$=c$+PeekByte(map,x+y*8)
			Next
			c$=RSet$(Replace$(c$,"0",""),13)
			For y=0 To 12
				PokeByte map,x+y*8,Mid$(c$,1+y,1)
			Next
		Next
		FreeBank tmp

		Return foundsomething

	End Select
End Function

Function FreeColumnz(bank)

	FreeImage PeekInt(bank,08)
	FreeTimer PeekInt(bank,12)
	FreeTimer PeekInt(bank,24)
	FreeGadget PeekInt(bank,00)
	FreeBank PeekInt(bank,28)

	For t=0 To 5
		time$=time$+Chr$(PeekByte(bank,32+t))
	Next
	DeleteFile "CS_TBL"+time$+".IT"
	DeleteFile "CS_TBLSFX1"+time$+".WAV"
	DeleteFile "CS_TBLSFX2"+time$+".WAV"
	DeleteFile "CS_TBLSFX3"+time$+".WAV"
	sound=PeekInt(bank,38):	If sound FreeSound sound
	sound=PeekInt(bank,42):	If sound FreeSound sound
	sound=PeekInt(bank,46):	If sound FreeSound sound
	
	FreeBank bank
End Function


I just uploaded a new update: now you can command your tanks! You can use Space to toggle Follow mode or Scatter mode. The enemy also "groups" it's tanks strategically.

Scoring has been added also.

Edit: Bug fixed where new reinforcements would not follow you if you had team mode set

exactly when does this contest end? :P

I'm not sure. Probably some time tonight since Frank extended it yesterday.

I wish I saw this thread earlier - I would have had more time to work on my game. So far I think I have about 5-6 hours into it.

"write a game in a week contest!" is more realistic ..

Yeah. That's probably why there aren't many entries. It's not easy to make a nice game in a single day.

If a competition was done well, you'd probably need some nice prizes, and advertize everywhere (including submitting the contest to the blitzbasic home page news). TGC has competitions almost every year (but they last months), and I really don't know why BRL doesn't. It's great advertising for you're product that way.

Did I win?

Actually, I don't know who won, or even exactly when the competition ends. I'm not sure is Frank is going to be a judge, or if votes will be used.

Too bad there aren't very many entries. Well, at least no-one will win first-place and last-place at the same time.

sswift: 2 prizes, first entry ....wooo, wooden spoon ... booo

\me hits all over the hit with an request for an .exe as I only have Blitz Plus and also can't be arsed to paste CS_TBLs in twice and compile. thx

Update: A "bumper" thing was added to the front of tanks to avoid orientation confusion. Also, enemy AI was improved (now with a better trajectory calculator). Several collision bugs have been fixed as well. All tanks are repaired (no more damage) when reinforcements arrive now.

I think the game gets more fun when you get into having >10 tanks, where you order your group to follow you. Almost nothing can stop you once you get going, until the AI starts teaming up also.

Hint: if you like crazy action, change this line:
tank\firetime = MilliSecs() + 1000

to this:
tank\firetime = MilliSecs() + 100


Grey: it's twice because the codebox here has a limited length..

Grey Alien: Here's a compile of my game - http://www.alsbonsai.com/john/TankBattle.exe

Man - I really love this idea and topic -

But, between work, kids, etc. - hard to find a full day - maybe doing this again, but for a week -

Really great to see what can be done so fast though.

Tank Battle Rocks! Keep the entries coming in, there is still more time!

Update: Better explosions effects added, and minor bugfixes and gameplay tweaks

Update: Now textures are used! (Procedurally generated)

P.S. I wouldn't have to clutter this up with updates if I knew when the contest ends - then I could just submit my final game once.

TankBattle is great! Good job, John and thanks for the Exe.
I got to level 14. Good, distracting, death-match fun.

That tank battle game doesn't work for me. I can't seem to fire at all. Pressing the left mouse button does nothing.

I found the bug. You simply check to see if millisecs() is greater than fire time. But my PC has been running for a week straight, and the number millisecs() is currently returning is negative. That makes it imporrible for millisecs() to be greater than the fire time.

You need to change your timing code to handle when millisecs() is negative. I'm sure some folks here have worked out how to do that. In my own games, I just use the difference in time from one frame to the next, and the milliseconds count up to 0 when they are negative, so timenow-timethen with negative milliseconds works out right to give you a positive length of time between frames.

The only thing to worry about then is when millisecs goes from +2 billion to -2 billion. I check that the same way I avoid bugs caused by unnaturally long pauses when windows is thrashing the disk.... I simply don't update till the next frame if the time between frames is greater than say, 100 - 200ms.

WOW JohnJ that is really neat! Excellent entry.
Common Frank gimme an .exe!

Grey,
Here you go c e l l u l a r.

John,
Can you post the source in the Code Archive: Miscellaneous? Thanks.

Update: The disabled tank fire bug is now fixed, hopefully (thanks to sswift). Also I fixed a minor problem where particles weren't displaying correctly after landing on the ground. A AI bug where the turret would move fast in one direction but slow in another is now fixed also.

Update: Now fragments are more realistic, and are the color of the tank (or object) they come from.

Sorry frank been busy. Yours is cool too, nice shading on the cells. Then infected they are supposed to just go black right? btw, what does rmb do? Note that when I first ran it the mouse movement for left/right was the wrong way round! Next run was fine, weird. Also the cells really have a lot of tearing (horizontal bands) on mine yet my PC is no souch, see specs in sig.

These 3D games are really cool.

CS_TBL. I know that about the code box, found it out myself before. *POST EXE*!! Also I won't look at it unless it's got a built in tracker and system generated 88KHz stereo samples on a 32 channel 20 minute classic piece with several movements, oh with plenty of reverb ;-p

atm the server I use to drop things on is down.. otherwise I'd post an .exe

about the classic piece: don't tempt me.. I'd be foolish enough to do it.. it's just that uhm.. well, what about being banned for posting 50meg of sourcecode in the forum, spread over 1000+ codeboxes? :D

CS_TBL: Email me the exe and I will host it for you.

http://www.gomarky.com/blogger/2005/10/puki-game.html

Large!

Very Nice puki, I wish it was in BlitzBasic.

vinyl: on it's way (edit, no it didn't, it bounced back (gmail).. which email to use?)

btw, is there also a sizelimit in the code archives?

Oops.. in my last update I accidentally left debug code in that gives you about 10 tanks initially (that makes it too easy!). It's fixed now.

CS_TBL's exe is here.

Nice one CS_TBL :)

yay CS_TBL. Nice music and sounds cool. But you need a "match" sound. Also I'm sure the match code is bugged, it really doesn't clear the blobs I am expecting it to, check it out a bit more. Also score!

Puki: neat gmae. Also "save my ass (from my wife)" sounds useful, v. useful, I think I'd need flowers every day tho'

Additions purely depend on how much time we get from uncle Frank.. I run a bit short of time lately..


so... come to daddy ^_^

but imho a match sound is even more important than a movement sound, it gives that "satisfaction" feeling.

Much needs to be added, such as actually seeing marbles explode orso.. now every match (and all the matches that follow upon a match) are erased all at once.

Time .. time .. which I don't have much of lately. Mainly because I'm composing for a TV-series with 12 episodes atm.. about each week there's a deadline... next one is this monday..

Oh, and bmax+gui arrived 2 days ago.. I'm trying out things as we speak, so that's also important ^_^

Well, I guess I'll also continue to update also until the deadline is announced.

Update: AI is much better, where tanks form squads (groups) and attack semi-strategically. Also, tanks who need help call for backup. This way, it's not so easy to totally monopolize the battlefield. Also, you can now read what other tanks of your team are saying to others, and a little of what the enemy says (nothing that would reveal any strategic movements).

Did I win yet?

John J, I got an illegal instruction and a MAV from your tank game while in observer mode (didn't notice it in the untextured version yesterday). Other than that, it's rather splendid - I particularly like to amass a massive force by retreating all my tanks while the other teams destroy each other :D

Time is almost up.

Ok - this was really fun.

This is the most I've done on a 'game' since I got blitz a few months ago.

Totally motivating.

So, I got a little carried away and used Tomak - I know it's probably not allowed for the contest - but it was too much fun.

I took out the sound in order to post this - but it's much more satisfying to blast these things with sound ;-)

I have never posted here - so I have no idea if this will work for everyone.

This would be fun to do again in another few weeks - maybe with a 'theme' like '2D Game in a week' or 'RPG Game in a week' -

Anyway - thanks Frank!

; Game in a day - well - more like 5 days
Graphics3D 800, 600, 16, 2
SetBuffer BackBuffer()
AppTitle "Master Blaster!"

;set up the fonts for the screen feedback
Global big
Global small
big = LoadFont("Fixedsys", 32)
small = LoadFont("Fixedsys", 16)

start_screen()

;set up tomak
Const numobj = 20
Const FPS=90
Const Rigid_Bodies=20,Animated_Bodies=6,Rigid_Particles=0
Global coll

Dim tname$(20),tMindex(20)
Global cur=0

Const PLAYER_COL= 1
Const LEVEL_COL = 2
Const ENEMY_COL = 3
Const BULLET_COL= 4
Const BOSS_COL = 5

Dim blocks(10)
Dim tok_block(10)

TOKSIM_SetRigidBodiesCount 100
TOKSIM_SetAnimatedBodiesCount Animated_Bodies
TOKSIM_SetRigidParticleCount Rigid_Particles
TOKSIM_SetControllersCount 0
TOKSIM_SetGeometriesCount 100

TOKSIM_CreateSimulator(0,-10,0)
TOKSIM_SetCollisionResponse PLAYER_COL, LEVEL_COL, 3
TOKSIM_SetCollisionResponse PLAYER_COL, ENEMY_COL, 3
TOKSIM_SetCollisionResponse ENEMY_COL, BULLET_COL, 3
TOKSIM_SetCollisionResponse ENEMY_COL, LEVEL_COL, 3
TOKSIM_SetCollisionResponse BULLET_COL, LEVEL_COL, 3
TOKSIM_SetCollisionResponse BULLET_COL, BOSS_COL, 3

;collisions
Collisions PLAYER_COL, LEVEL_COL, 2, 2				;player to level
Collisions PLAYER_COL, ENEMY_COL, 1, 2				;player to badguy
Collisions ENEMY_COL, LEVEL_COL,  2, 2				;badguy to level
Collisions BULLET_COL, LEVEL_COL, 2, 2				;bullet to level
Collisions BULLET_COL, ENEMY_COL, 3, 2				;bullet to badguy
Collisions BULLET_COL, BOSS_COL, 3,2


;lightning info
Global Range# = 0
Global Division# = 0
Global DummyEntity = CreatePivot()

Type LightningType
	Field Entity
End Type

Global ang#=0

;TOKSIM_SetMaterial 2,1.0,.9 ; Rubber(Orange)

Type level
	Field rb
	Field speed#
	Field gun
	Field lev
	Field force
	Field enemyhealth
	Field enemy_count
	Field speed_adjustment
	Field num_boss
	Field boss_size
	Field boss_mass
	Field boss_start_health
	Field boss_vel#
	Field city_size
	Field level_inc
	Field enemyhealth_org
	Field enemy_count_org
	Field enemy_dist_shot
	Field boss_health
	Field boss_dead
End Type

Type boss
	Field ent
	Field rb
	Field x#
	Field y#
	Field z#
	Field speed#
	Field health
	Field vel#
	Field hit
End Type

Type objects
	Field obj
	Field rb
	Field state
	Field num
	Field health
End Type

Type bullettype	
  Field entityhandle
  Field tomak_i
  Field tomak
  Field dead
  Field num
End Type

Type scene
	Field ground
	Field wall1, wall2, wall3, wall4
	Field beep, guns
	Field boss_shock, enemy_tick
	Field boss_kill
End Type

Type player
	Field ent
	Field weapon1
	Field weapon2
	Field camera
	Field score
	Field speed#
	Field health
	Field hit
	Field hit_time
	Field num_bullets
End Type

Type city
	Field block_ent
	Field rb_ent
End Type

Global level.level = New level
Global scene.scene = New scene
Global player.player = New player
Global boss.boss = New boss
Global city.city = New city

light = CreateLight()
RotateEntity light, 30, 30, 0
player\ent = CreatePivot()

;put a tomak wrapper around the camera
 
;  box = CreateCube( player )
;  cameratomak = TOKRB_Create()
;  geom = TOKRB_AddBox( cameratomak,2.0,2.0,2.0)
;  TOKGEOM_SetMaterialIndex geom,1
;  TOKRB_SetPosition cameratomak,EntityX( player ) ,EntityY(player),EntityZ(player)
;  TOKRB_SetLinearDamping cameratomak,0.001
;  TOKRB_SetAngularDamping cameratomak,0.001	
;  TOKRB_SetMass cameratomak,2.0
;  TOKRB_SetBoxInertiaTensor cameratomak,2.0,1.0,1.0,2.0  
;  EntityColor box,Rnd(100,230),Rnd(100,230),Rnd(100,230) 

	;create rearview mirror
;	cam2 = CreateCamera( camera )
	;rotate it
;	RotateEntity cam2, 0,0,0
	;hide it
;	HideEntity p\cam2
	;specify viewport
;	CameraViewport cam2,10,335,160,110


player\camera = CreateCamera(player\ent)
CameraRange player\camera, .01, 2500
CameraClsColor player\camera, 108,122,255

;start with level 1
level\rb = 5
level\speed = 4
level\gun = 1
level\lev = 1
level\enemyhealth = 30
level\enemyhealth_org = 30
level\enemy_count_org = 5
level\force = 1000 ;2250
level\num_boss = 1
level\boss_size = 1
level\boss_mass = 6
level\enemy_count = 5
level\boss_vel = .1
level\city_size = 10
level\level_inc = 1.25
level\enemy_dist_shot = 5
level\boss_start_health = 100
level\boss_dead = 0

boss\hit = 0
level\boss_health = level\boss_start_health


;set up player
player\score = 0
player\speed = .3
player\health = 100

;set up boss health
boss\health = level\boss_health

;create the first scene
create_scene()

;Create Level
create_level(  )

;create the player
create_player( ) 

;create the boss
create_boss()

;for some reason this needs to be here ???
EntityType scene\ground, LEVEL_COL


rot#=0

period=1000/FPS
time=MilliSecs()-period

imptime=MilliSecs()

While Not KeyHit(1) 						;ESC key
	Repeat
		elapsed=MilliSecs()-time
	Until elapsed

	ticks=elapsed/period
	tween#=Float(elapsed Mod period)/Float(period)

	For k=1 To ticks
		time=time+period
		If k=ticks Then CaptureWorld

		TOKSIM_Advance(1.5/FPS,1)
		
		camx#=Cos(rot#)*20
		camz#=Sin(rot#)*20
	Next


If rot#>360 Then rot#=0

;always reset the lightning
ResetLightning()
	
;how close is enemy?
enemy_distance()

;tomak
	For ob.objects = Each Objects
	    PositionEntity ob\obj,TOKRB_GetX#(ob\rb),TOKRB_GetY#(ob\rb),TOKRB_GetZ#(ob\rb) 
	    RotateEntity ob\obj,TOKRB_GetPitch#(ob\rb),TOKRB_GetYaw#(ob\rb),TOKRB_GetRoll#(ob\rb),False
	    If KeyDown(57) Then
	     TOKRB_ApplyImpulse2 ob\rb,Rnd(-.3,.3),Rnd(-1.5,3.0),Rnd(-.3,.3),Rnd(-.05,.05),Rnd(.05,.05),Rnd(-.05,.05)
	;	 TOKRB_ApplyImpulse2 cameratomak, Rnd(-.3,.3),Rnd(-1.5,3.0),Rnd(-.3,.3),Rnd(-.05,.05),Rnd(.05,.05),Rnd(-.05,.05)
	
		;if the block falls out of the zone - delete it
		If TOKRB_GetY( ob\rb ) < 0 Then
			TOKRB_Free ob\rb
	        FreeEntity ob\obj
			Delete ob
			
			;then take down the count
			level\enemy_count = level\enemy_count -1 
		End If
	
	    EndIf
	Next
;end tomak

  wkey = KeyDown(17)
  skey = KeyDown(31)
  akey = KeyDown(30)
  dkey = KeyDown(32)
  mouse1 = MouseHit(1)
  mouse2 = MouseHit(2)

  move=0
  If wkey Then 
	MoveEntity player\ent, 0, 0, player\speed
	move=1
  End If
  If skey Then 
	MoveEntity player\ent, 0, 0, -player\speed
	move=1
  End If
  If akey Then 
	MoveEntity player\ent, -player\speed, 0, 0
	move=1
  End If
  If dkey Then 
	MoveEntity player\ent, player\speed, 0, 0
	move=1
  End If

  TurnEntity player\ent, 0, -MouseXSpeed()/5.0, 0
  TurnEntity player\camera, MouseYSpeed()/5.0, 0, 0
  If EntityPitch( player\camera ) < -45
    RotateEntity player\camera, -45, EntityYaw( player\camera ), EntityRoll( player\camera ) 
  EndIf 
  If EntityPitch( player\camera ) > 45					;don't allow camera to look above 45 degrees
    RotateEntity player\camera, 45, EntityYaw( player\camera ), EntityRoll( player\camera )
  EndIf
  MoveMouse GraphicsWidth()/2, GraphicsHeight()/2		;reset mouse position to middle of screen

  TranslateEntity player\ent, 0, -.1, 0				;simple gravity

  ;when the user moves - add a little bounce for the blocks
  If move=1 Then
	 For ob.objects = Each objects
	  TOKRB_ApplyImpulse ob\rb,0,.25,0
	 Next
	move=0
  End If


  If mouse1
	shoot( 1 )
  End If

  If mouse2
	shoot( 2 )
  End If

  For bullet.bullettype = Each bullettype			;iterate through all of the bullets
    PositionEntity bullet\tomak,TOKRB_GetX#(bullet\tomak_i),TOKRB_GetY#(bullet\tomak_i),TOKRB_GetZ#(bullet\tomak_i) 
    RotateEntity bullet\tomak,TOKRB_GetPitch#(bullet\tomak_i),TOKRB_GetYaw#(bullet\tomak_i),TOKRB_GetRoll#(bullet\tomak_i),False

	;can we delete these bullets?
	;first check for bullet dead
	If bullet\dead Then
	  TOKRB_Free	bullet\tomak_i
      FreeEntity bullet\tomak		
      Delete bullet					
	End If
		
    If Abs(EntityX(bullet\tomak, 1)) > 1000	
	  TOKRB_Free	bullet\tomak_i
      FreeEntity bullet\tomak	
      Delete bullet				
    ElseIf Abs(EntityY( bullet\tomak, 1)) > 1000
	  TOKRB_Free	bullet\tomak_i
      FreeEntity bullet\tomak		
      Delete bullet						
    ElseIf Abs(EntityZ ( bullet\tomak, 1)) > 1000	
	  TOKRB_Free	bullet\tomak_i
      FreeEntity bullet\tomak
      Delete bullet						;delete the bullet
    EndIf
  Next


UpdateWorld							;figures out collisions



  For bullet = Each bullettype				
	coll = CountCollisions( bullet\tomak )
    If CountCollisions(bullet\tomak) > 0		
      enemyhit = EntityCollided(bullet\tomak, ENEMY_COL )	
      bos@#!*  = EntityCollided(bullet\tomak, BOSS_COL )
      If enemyhit > 0						

		 For ob.objects = Each objects
         If enemyhit = ob\obj	
			bullet\dead = 1
			player\score = player\score + 1
			;health of the enemy goes down by 10
			ob\health = ob\health - 10
           EndIf

			;while we're iterating - check their health
			If ob\health =< 0 Then
				TOKRB_Free	ob\rb
			    FreeEntity ob\obj
			    Delete ob
				level\enemy_count = level\enemy_count -1
			End If	
	     Next
	
      EndIf

		; did the boss get hit
		If bos@#!* > 0 Then
			level\boss_health = level\boss_health - 10
			boss\hit = 1

		End If 
    EndIf


	; after the collisions - check for death of the bullets
	If bullet\dead = 1 Then
  			  TOKRB_Free	bullet\tomak_i
    		  FreeEntity bullet\tomak			;delete the bullet mesh;
		      Delete bullet	
              player\num_bullets = player\num_bullets -1
	End If
	
  Next


	If KeyHit(57) Then
	 For ob.objects = Each objects
	  TOKRB_ApplyImpulse ob\rb,0,25,0
	;  TOKRB_ApplyImpulse cameratomak, 0,25,0
	 Next
EndIf

; check for bullets - can we delete idle ones?
check_bullets()

;still alive?
still_alive()

boss_update()


RenderWorld tween							;draws the 3d scene
SetFont small
Color 255,255,255
Text 10, 10, "X: " + EntityX( player\ent )
Text 10, 20, "Y: " + EntityY( player\ent )
Text 10, 30, "Z: " + EntityZ( player\ent )
Text 10, 40, "Bullets Out: " + player\num_bullets
Text 10, 60, "Enemy Count: " + level\enemy_count
Text 10, 70, "Score: "  + player\score
Text 10, 80, "Player Health: " + player\health
Text 10, 90, "Boss Health: " + level\boss_health 

  Flip False								;displays the scene to the screen

Wend								;loop until the ESC key is pressed

For ob.objects = Each objects
  TOKRB_Free	ob\rb
  FreeEntity 	ob\obj
  Delete ob
Next 

For b.bullettype = Each bullettype
	  TOKRB_Free	b\tomak_i
	  FreeEntity b\tomak			;delete the bullet mesh
      Delete b	
Next

TOKSIM_DestroySimulator()
End

Function start_screen()

	SetBuffer(BackBuffer())
    SetFont big
	Color 0,128,255
	
	screen = GraphicsHeight()/2-90
	Repeat
		
		Text(GraphicsWidth()/2,screen,"Master Blaster",1)
		Text(GraphicsWidth()/2,screen+40,"Shoot everything - ",1)
		Text(GraphicsWidth()/2,screen+80,"...ha ha ha ha ha...",1)
		Text(GraphicsWidth()/2,screen+160,"press <space> to start",1)
		Flip()
	Until KeyDown(57)
	FlushKeys()

End Function

Function create_level(  )

For i=1 To level\rb
	ob.Objects = New Objects
	ob\obj = CreateCube()
	ScaleEntity ob\obj,1,0.5,0.5 
	;collision info
	EntityType ob\obj, ENEMY_COL
	EntityRadius ob\obj, .5, .95
	
	; end collision
	
	;id them
    ob\num = i
	ob\health = level\enemyhealth
	; end id

  ob\rb = TOKRB_Create()
  geom = TOKRB_AddBox( ob\rb ,2.0,1.0,1.0)
  TOKGEOM_SetMaterialIndex geom,1 
  TOKRB_SetPosition ob\rb,x#,2+i*0.2,z#
  TOKRB_SetLinearDamping ob\rb,0.001
  TOKRB_SetAngularDamping ob\rb,0.001	
  TOKRB_SetMass ob\rb,2.0
  TOKRB_SetBoxInertiaTensor ob\rb,2.0,1.0,1.0,2.0  
  TOKRB_SetCollisionID( ob\rb,ENEMY_COL)
  EntityColor ob\obj,Rnd(100,230),Rnd(100,230),Rnd(100,230) 

Next


End Function

Function start_level()

;clear the screen
Cls

; create the scene - depending on the level
; create the box
create_scene()

;create the player - depending on the level

;return and ready to rumble!

End Function

Function create_scene()

scene\ground = CreateCube()
EntityColor scene\ground,5,5,55 
ScaleEntity scene\ground,50,5,50 
;EntityType scene\ground, LEVEL_COL
PositionEntity scene\ground,0,-5,0
abground = TOKAB_Create()
TOKAB_AddBox(abground,100.0,10.0,100.0)
TOKAB_SetPosition(abground,0.0,-5.0,0.0)

scene\wall1 = CreateCube()
EntityColor scene\wall1,25,25,55 
ScaleEntity scene\wall1,2,10,50 
PositionEntity scene\wall1,50,0,0
EntityType scene\wall1, LEVEL_COL
abwall1 = TOKAB_Create()
TOKAB_AddBox(abwall1,4.0,20.0,100.0)
TOKAB_SetPosition(abwall1,50.0,0,0.0)

scene\wall2 = CreateCube()
EntityColor scene\wall2,25,25,55 
ScaleEntity scene\wall2,2,10,50 
EntityType scene\wall2, LEVEL_COL
PositionEntity scene\wall2,-50,0,0
abwall2 = TOKAB_Create()
TOKAB_AddBox(abwall2,4.0,20.0,100.0)
TOKAB_SetPosition(abwall2,-50.0,0,0.0)

scene\wall3 = CreateCube()
EntityColor scene\wall3,25,25,55 
EntityType scene\wall3, LEVEL_COL
ScaleEntity scene\wall3,50,10,2 
PositionEntity scene\wall3,0,0,-50
abwall3 = TOKAB_Create()
TOKAB_AddBox(abwall3,100.0,20.0,4.0)
TOKAB_SetPosition(abwall3,0.0,0,-50.0)

scene\wall4 = CreateCube()
EntityColor scene\wall4,25,25,55
EntityType scene\wall4, LEVEL_COL 
ScaleEntity scene\wall4,50,10,2 
PositionEntity scene\wall4,0,0,50
abwall4 = TOKAB_Create()
TOKAB_AddBox(abwall4,100.0,20.0,4.0)
TOKAB_SetPosition(abwall4,0.0,0,50.0)

draw_city()

End Function

Function create_player( )

	player\num_bullets = 0
	
	;right gun
	player\weapon1 = CreateCylinder(32, 1, player\camera)
	RotateMesh player\weapon1, 90, 0, 0
	ScaleEntity player\weapon1, .05, .05, .2
	EntityColor player\weapon1, 50, 50, 50
;	EntityType player\weapon1, PLAYER_COL
	
	;megaweapon - if we're on level 2
	If level\gun = 2 Then
		player\weapon2 = CreateCylinder( 32,1, player\camera)
		PositionEntity player\weapon2, -.45,-.20,.5
		RotateMesh player\weapon2, 90, 0,0
		ScaleEntity player\weapon2, .05,.05,.2
		EntityColor player\weapon2, 50,50,50
	End If
	
	MoveEntity player\camera, 0, .9, 0		
	MoveEntity player\weapon1, .1, -.15, .1	
	MoveEntity player\ent, 20, 1, -20		
	EntityType player\ent, PLAYER_COL		
	EntityRadius player\ent, .3, .95		


End Function

Function shoot( how )

	If how = 1 Then 
    bullet.bullettype = New bullettype				;create a bullet

	;1st bullet
	player\num_bullets = player\num_bullets + 1
	bullet\tomak = CreateSphere()
	bullet\dead = 0
	ScaleEntity bullet\tomak, .25, .25, .25
	EntityType bullet\tomak, BULLET_COL				
	EntityRadius bullet\tomak, .1, .95	
	bullet\tomak_i = TOKRB_Create()
	TOKRB_GravityEnable bullet\tomak_i, 1
	TOKRB_AddSphere bullet\tomak_i,.5
    TOKGEOM_SetMaterialIndex bullet\tomak_i,1 
	TOKRB_SetPosition bullet\tomak_i,EntityX( player\weapon1, 1), EntityY( player\weapon1, 1), EntityZ( player\weapon1, 1)
    TOKRB_SetAngularDamping bullet\tomak_i,0.002
    TOKRB_SetLinearDamping bullet\tomak_i,0.001 
    TOKRB_SetMass bullet\tomak_i,17.0 ; was 7
    TOKRB_SetSphereInertiaTensor bullet\tomak_i,2,2.0 
	TOKRB_SetCollisionID( bullet\tomak_i,BULLET_COL)
    EntityColor bullet\tomak,Rnd(100,230),Rnd(100,230),Rnd(100,230)


	amount#= level\force ;was 150
	TFormVector 0,0,1,player\camera,0
	TOKRB_ApplyImpulse bullet\tomak_i,TFormedX()*amount#,TFormedY()*amount#,TFormedZ()*amount#
	;second bullet - is there a second gun?
	If level\gun = 2 Then
		player\num_bullets = player\num_bullets + 1
	    bullet.bullettype = New bullettype				;create a bullet
		;2st bullet
		bullet\tomak = CreateSphere()
		bullet\dead = 0
		ScaleEntity bullet\tomak, .25, .25, .25
		EntityType bullet\tomak, BULLET_COL				
		EntityRadius bullet\tomak, .1, .95	
		bullet\tomak_i = TOKRB_Create()
		TOKRB_GravityEnable bullet\tomak_i, 1
		TOKRB_AddSphere bullet\tomak_i,.5
	    TOKGEOM_SetMaterialIndex bullet\tomak_i,1 
		TOKRB_SetPosition bullet\tomak_i,EntityX( player\weapon2, 1), EntityY( player\weapon2, 1), EntityZ( player\weapon2, 1)
	    TOKRB_SetAngularDamping bullet\tomak_i,0.002
	    TOKRB_SetLinearDamping bullet\tomak_i,0.001 
	    TOKRB_SetMass bullet\tomak_i,17.0 ; was 7
	    TOKRB_SetSphereInertiaTensor bullet\tomak_i,2,2.0 
		TOKRB_SetCollisionID( bullet\tomak_i,BULLET_COL)
	    EntityColor bullet\tomak,Rnd(100,230),Rnd(100,230),Rnd(100,230)
	
		amount#=level\force 
		TFormVector 0,0,1,camera,0
		TOKRB_ApplyImpulse bullet\tomak_i,TFormedX()*amount#,TFormedY()*amount#,TFormedZ()*amount#
	End If
	
	ElseIf how=2 Then ;shooting at the boss
	
	    bullet.bullettype = New bullettype				;create a bullet
		;1st bullet
		player\num_bullets = player\num_bullets + 1
		bullet\tomak = CreateSphere()
		bullet\dead = 0
		ScaleEntity bullet\tomak, .75, .75, .75
		EntityType bullet\tomak, BULLET_COL				
		EntityRadius bullet\tomak, .1, 2	
		bullet\tomak_i = TOKRB_Create()
		TOKRB_GravityEnable bullet\tomak_i, 1
		TOKRB_AddSphere bullet\tomak_i,2
	    TOKGEOM_SetMaterialIndex bullet\tomak_i,1 
		TOKRB_SetPosition bullet\tomak_i,EntityX( player\weapon1, 1), EntityY( player\weapon1, 1), EntityZ( player\weapon1, 1)
	    TOKRB_SetAngularDamping bullet\tomak_i,0.002
	    TOKRB_SetLinearDamping bullet\tomak_i,0.001 
	    TOKRB_SetMass bullet\tomak_i,57.0 ; was 7
	    TOKRB_SetSphereInertiaTensor bullet\tomak_i,2,57 
		TOKRB_SetCollisionID( bullet\tomak_i,BULLET_COL)
	    EntityColor bullet\tomak,Rnd(100,230),Rnd(100,230),Rnd(100,230)
		
		amount#= level\force*1.5 ;was 150
		TFormVector 0,0,1,player\camera,0
		TOKRB_ApplyImpulse bullet\tomak_i,TFormedX()*amount#,TFormedY()*amount#,TFormedZ()*amount#
	
	End If 


End Function

Function next_level()

	;give a few seconds to change
    Delay 3000

	Cls
	
	FlushKeys
	FlushMouse
	
	SetBuffer(BackBuffer())
	
	SetFont big
	Color 0,128,255
	
	screen = GraphicsHeight()/2-90
	
	Repeat
		Text(GraphicsWidth()/2,screen ,"Master Blaster- level " + level\lev,1)
		Text(GraphicsWidth()/2,screen +40,"Shoot everything - again!",1)
		Text(GraphicsWidth()/2,screen +80,"...ha ha ha ha ha...",1)
		Text(GraphicsWidth()/2,screen +160,"press <space> to start",1)
		Flip()
	Until KeyDown(57)
	FlushKeys()

	player\speed = player\speed + level\speed_adjustment

	;update level attributes
	;start with level 1
	level\lev = level\lev + 1
	level\rb = level\rb * 1.5
	level\speed# = level\speed# * level\level_inc
	level\enemyhealth = level\enemyhealth * level\level_inc
	level\force = level\force * level\level_inc
	level\enemy_count = level\rb
	level\boss_vel = level\boss_vel * level\level_inc
	level\city_size = level\city_size * level\level_inc
	level\boss_mass = level\boss_mass * level\level_inc
	level\enemy_dist_shot = level\enemy_dist_shot * level\level_inc
	level\boss_health= level\boss_start_health * level\level_inc

	
	If level\lev => 4 Then
	level\gun = 2
	level\num_boss = 2
	level\boss_size = 2
	
	level\boss_dead = 0
	
	;with new guns - re-arm the player
	create_player()
	End If

	
	;destroy the old city
	
	destroy_city()
	
	;create the new city
	draw_city()
	
	create_level()
	
	create_boss()
	
End Function

Function still_alive()

;	ob.objects = New objects
;		If ob = Null Then
;			next_level()
;		End If

If level\enemy_count <= 0 Then
	next_level()
End If
			
;	 For ob.objects = Each objects
;		;if all the objects are gone - start a new level
;			If ob = Null Then
;				next_level()
;			End If
 ;    Next

End Function

Function create_boss()
;each level has one or more boses - they are big - massive creatures (well really spheres) that chase you

boss.boss = New boss

	x# = 0
	y# = 0
	z# = 0

	boss\vel# = level\boss_vel#
	boss\ent = CreateSphere()
	ScaleEntity boss\ent,level\boss_size, level\boss_size, level\boss_size
	;collision info
	EntityType boss\ent, BOSS_COL
	PositionEntity boss\ent, x#, y#+1, z#
	EntityRadius boss\ent, 1, 1
	EntityColor boss\ent, 255,255,255
	; end collision
	
	;id them
	boss\health = level\boss_start_health
	; end id
	
	;texture the boss
	testtex=CreateTexture(128,128)
;	SetBuffer TextureBuffer(testtex)
	For x=0 To 10 
	  Color 0,0,0
	  Plot 4+Rand(120),4+Rand(120)
	Next
	
;    SetBuffer BackBuffer()
;    EntityTexture boss\ent,testtex

  w=MeshWidth( boss\ent) * level\boss_size
  h=MeshHeight( boss\ent) * level\boss_size
  d=MeshDepth( boss\ent) * level\boss_size
 
  boss\rb = TOKRB_Create()
  geom = TOKRB_AddSphere( boss\rb, level\boss_size*2 )
  TOKRB_GravityEnable boss\rb, 1
  TOKGEOM_SetMaterialIndex geom,1 
  TOKRB_SetPosition boss\rb,x#,y#+1,z#
  TOKRB_SetLinearDamping boss\rb,0.002
  TOKRB_SetAngularDamping boss\rb,0.002	
  TOKRB_SetMass boss\rb, level\boss_mass
  TOKRB_SetSphereInertiaTensor boss\rb,level\boss_size,level\boss_mass 
  TOKRB_SetCollisionID( boss\rb, ENEMY_COL )
 

End Function

Function boss_update( )

;can't do this if the boss isn't alive!
If level\boss_health > 0 Then

	x# = EntityX(player\ent)
	y# = EntityY(player\ent)
	z# = EntityZ(player\ent)

		;vector to x,y,z
		
		dx#=(x-EntityX(boss\ent))
		dy#=(y-EntityY(boss\ent))
		dz#=(z-EntityZ(boss\ent))
		
		;length of vector
		
		l#=Sqr(dx*dx+dy*dy+dz*dz)
		
		;make the vector a unit vector, length = 1
		
		dx=dx/l
		dy=dy/l
		dz=dz/l
		
		;check if he is hit - if so - stop him
		If boss\hit = 0 Then
			TranslateEntity boss\ent,dx*boss\vel#,dy*boss\vel#,dz*boss\vel#
		Else
			boss\hit = 1
		End If

Else
	If level\boss_dead = 0 Then ;only do this if boss isn't already dead
		;kill boss - add to score - 
		  TOKRB_Free	boss\rb
   		  FreeEntity boss\ent
	      Delete boss
    	  player\score = player\score + 100
		  level\boss_dead = 1
	End If
End If
		
End Function

Function check_bullets()
	For bullet.bullettype = Each bullettype
	;also while we're iterating, check to see if they're idle - if so - delete them
	If TOKRB_IsIdle( bullet\tomak_i ) Then
		  TOKRB_Free	bullet\tomak_i
   		  FreeEntity bullet\tomak			;delete the bullet mesh;
	      Delete bullet	
    	  player\num_bullets = player\num_bullets - 1
	End If
	Next 

	; if we have more than 10 bullets on the scene - start deleting
	If player\num_bullets >= 10 Then
	bullet.bullettype = First bullettype
	  TOKRB_Free	bullet\tomak_i
	  FreeEntity bullet\tomak			;delete the bullet mesh;
      Delete bullet	
   	  player\num_bullets = player\num_bullets - 1
	End If

End Function

Function draw_city()
;add these extra objects in
For i=1 To level\city_size

	c.city = New city
    c\block_ent =CreateCube()
   ;EntityTexture fillers(i),testtex
	scale_x# = Rand(5,10)
	scale_y# = Rand(10,25)
	scale_z# = Rand(5,10)
	x# = Rand(-40,40)
	y# = Rand(-40,40)
	z# = Rand(-40,40)
	
   ScaleEntity c\block_ent,scale_x#,scale_y#,scale_z#
   PositionEntity c\block_ent,x#,0,z#
   EntityType c\block_ent,LEVEL_COL

	;texture them
	testtex=CreateTexture(128,128)
	SetBuffer TextureBuffer(testtex)
	For x=0 To 100 
	  Color 193,193,0
	  Plot 4+Rand(120),4+Rand(120)
	Next
	
	SetBuffer BackBuffer()
	EntityTexture c\block_ent,testtex
	
     c\rb_ent = TOKRB_Create()
	 w=MeshWidth( c\block_ent )*scale_x
	 h=MeshHeight( c\block_ent )*scale_y
	 d=MeshDepth( c\block_ent )*scale_z

     geom = TOKRB_AddBox( c\rb_ent ,w*2,h*2,d*2 )
	 TOKGEOM_SetMaterialIndex geom,1 
	 TOKRB_SetPosition c\rb_ent ,x#,y#,z#
	 TOKRB_SetLinearDamping c\rb_ent ,0.001
	 TOKRB_SetAngularDamping c\rb_ent ,0.001	
	 TOKRB_SetMass c\rb_ent,2.0
	 TOKRB_SetBoxInertiaTensor c\rb_ent,2.0,1.0,1.0,2.0  
	 TOKRB_SetCollisionID( c\rb_ent ,LEVEL_COL )
	 EntityColor c\block_ent ,255,255,255 ;Rnd(100,230),Rnd(100,230),Rnd(100,230) 
	
Next


End Function

Function destroy_city()
	For c.city = Each city
	
	  TOKRB_Free c\rb_ent
      FreeEntity c\block_ent
      Delete c
		
	Next
	
	;destroy all the left over bullets
	For b.bullettype = Each bullettype
	  TOKRB_Free	b\tomak_i
	  FreeEntity b\tomak
      Delete b	
	Next
End Function

Function enemy_distance()

;can't do this if the boss isn't alive!
If level\boss_health > 0 Then
	;check the distance
	If EntityDistance( player\ent, boss\ent ) < level\enemy_dist_shot Then
			CreateLightning( boss\ent, player\ent, 10, .5 )
			
			;now I'm hit with that lightning - show red screen / and jolt
			CameraClsColor player\camera, 255,0,0
			TranslateEntity player\ent, EntityX( player\ent )* .02  , EntityY( player\ent ) * .02 , EntityZ( player\ent ) * .02
			
			;if i'm hit - then let the player recover - a few secs..
			player\hit = True
	End If
	
	If player\hit = True Then
		If player\hit_time <= 0 Then
			CameraClsColor player\camera, 108,122,255
			;if i'm hit - decrease health
			player\health = player\health - 10
			player\hit_time = 100
			player\hit = False
		Else
			player\hit_time = player\hit_time - 10
		End If
	End If
End If

	
End Function

Function CreateLightning( FromEntity, ToEntity, Parts, Deviation# )
;got this function from EdzUp
	Local DeviationEntity = CreatePivot()
	Local TargetEntity = CreatePivot()
	Local TE=CreatePivot()
	Local PartCount = 0
	
	PositionEntity DummyEntity, EntityX#( FromEntity ), EntityY#( FromEntity ), EntityZ#( FromEntity )
	PointEntity DummyEntity, ToEntity
	Range# = EntityDistance#( FromEntity, ToEntity )
	
	Division# = Range# / Parts
	
	PositionEntity DeviationEntity, EntityX#( FromEntity ), EntityY#( FromEntity ), EntityZ#( FromEntity )
	
	For PartCount = 0 To Parts-1
		PositionEntity TargetEntity, EntityX#( DummyEntity ), EntityY#( DummyEntity ), EntityZ#( DummyEntity )
		MoveEntity TargetEntity, 0, Rnd( Deviation# )-Rnd( Deviation# ), Rnd( Deviation# )-Rnd(Deviation#)

		Lightning.LightningType = New LightningType
		Lightning\Entity = CreateSight()

		PointEntity DeviationEntity, TargetEntity
		
		PositionEntity Lightning\Entity, EntityX#( Deviationentity ), EntityY#( Deviationentity ), EntityZ#( Deviationentity )
		RotateEntity Lightning\Entity, EntityPitch#( DeviationEntity ), EntityYaw#( DeviationEntity ), EntityRoll#( DeviationEntity )
		ScaleEntity Lightning\Entity, EntityDistance#( DeviationEntity, TargetEntity ), .02, 1
		TurnEntity Lightning\Entity, 0, 90, 0
		
		;move the deviationentity to the target
		PositionEntity DeviationEntity, EntityX#( TargetEntity, 1 ), EntityY#( TargetEntity, 1 ), EntityZ#( TargetEntity, 1 )
		MoveEntity DummyEntity, 0, 0, Division#

	Next

	PositionEntity TargetEntity, EntityX#( ToEntity ), EntityY#( ToEntity ), EntityZ#( ToEntity )

	Lightning.LightningType = New LightningType
	Lightning\Entity = CreateSight()

	PointEntity DeviationEntity, TargetEntity
		
	PositionEntity Lightning\Entity, EntityX#( Deviationentity ), EntityY#( Deviationentity ), EntityZ#( Deviationentity )
	RotateEntity Lightning\Entity, EntityPitch#( DeviationEntity ), EntityYaw#( DeviationEntity ), EntityRoll#( DeviationEntity )
	ScaleEntity Lightning\Entity, EntityDistance#( DeviationEntity, TargetEntity ), .02, 1
	TurnEntity Lightning\Entity, 0, 90, 0
	
	FreeEntity DeviationEntity
	FreeEntity TargetEntity
End Function

Function CreateSight()
	;by Zenith
    sprite=CreateMesh()
    he=CreateBrush(255,255,255)
    v=CreateSurface(sprite,he)
    FreeBrush he
    AddVertex ( v,0,1,0,1,0)  ; top left 0,1;1,0
    AddVertex ( v,1,1,0,0,0)   ; top right 1,1;1,1
    AddVertex ( v,0,-1,0,1,1) ; bottom left 0,0;,0,0
    AddVertex ( v,1,-1,0,0,1)  ; bottom right 1,0;0,1
    AddTriangle( v,0,1,2)
    AddTriangle( v,3,2,1)
	TurnEntity sprite,0,0,0
	EntityFX sprite,17
	
    Return sprite
End Function

Function ResetLightning()
	For Lightning.LightningType = Each LightningType
		If Lightning<>Null
			If Lightning\Entity<>0 Then FreeEntity Lightning\Entity
			Delete Lightning
		EndIf
	Next
End Function




Ok - fixed a bug (one of many I'm sure) about killing the boss.

Update - Just added John J.'s equalizing code.
Thanks John!

; Game in a day - well - more like 5 days
Graphics3D 800, 600, 16, 2
SetBuffer BackBuffer()
AppTitle "Master Blaster!"

;set up the fonts for the screen feedback
Global big
Global small
big = LoadFont("Fixedsys", 32)
small = LoadFont("Fixedsys", 16)

;Equalization
Global prevmillisecs, timestep#

start_screen()

;set up tomak
Const numobj = 20
Const FPS=90
Const Rigid_Bodies=20,Animated_Bodies=6,Rigid_Particles=0
Global coll

Dim tname$(20),tMindex(20)
Global cur=0

Const PLAYER_COL= 1
Const LEVEL_COL = 2
Const ENEMY_COL = 3
Const BULLET_COL= 4
Const BOSS_COL = 5

Dim blocks(10)
Dim tok_block(10)

TOKSIM_SetRigidBodiesCount 100
TOKSIM_SetAnimatedBodiesCount Animated_Bodies
TOKSIM_SetRigidParticleCount Rigid_Particles
TOKSIM_SetControllersCount 0
TOKSIM_SetGeometriesCount 100

TOKSIM_CreateSimulator(0,-10,0)
TOKSIM_SetCollisionResponse PLAYER_COL, LEVEL_COL, 3
TOKSIM_SetCollisionResponse PLAYER_COL, ENEMY_COL, 3
TOKSIM_SetCollisionResponse ENEMY_COL, BULLET_COL, 3
TOKSIM_SetCollisionResponse ENEMY_COL, LEVEL_COL, 3
TOKSIM_SetCollisionResponse BULLET_COL, LEVEL_COL, 3
TOKSIM_SetCollisionResponse BULLET_COL, BOSS_COL, 3

;collisions
Collisions PLAYER_COL, LEVEL_COL, 2, 2				;player to level
Collisions PLAYER_COL, ENEMY_COL, 1, 2				;player to badguy
Collisions ENEMY_COL, LEVEL_COL,  2, 2				;badguy to level
Collisions BULLET_COL, LEVEL_COL, 2, 2				;bullet to level
Collisions BULLET_COL, ENEMY_COL, 3, 2				;bullet to badguy
Collisions BULLET_COL, BOSS_COL, 3,2


;lightning info
Global Range# = 0
Global Division# = 0
Global DummyEntity = CreatePivot()

Type LightningType
	Field Entity
End Type

Global ang#=0

;TOKSIM_SetMaterial 2,1.0,.9 ; Rubber(Orange)

Type level
	Field rb
	Field speed#
	Field gun
	Field lev
	Field force
	Field enemyhealth
	Field enemy_count
	Field speed_adjustment
	Field num_boss
	Field boss_size
	Field boss_mass
	Field boss_start_health
	Field boss_vel#
	Field city_size
	Field level_inc
	Field enemyhealth_org
	Field enemy_count_org
	Field enemy_dist_shot
	Field boss_health
	Field boss_dead
End Type

Type boss
	Field ent
	Field rb
	Field x#
	Field y#
	Field z#
	Field speed#
	Field health
	Field vel#
	Field hit
End Type

Type objects
	Field obj
	Field rb
	Field state
	Field num
	Field health
End Type

Type bullettype	
  Field entityhandle
  Field tomak_i
  Field tomak
  Field dead
  Field num
End Type

Type scene
	Field ground
	Field wall1, wall2, wall3, wall4
	Field beep, guns
	Field boss_shock, enemy_tick
	Field boss_kill
End Type

Type player
	Field ent
	Field weapon1
	Field weapon2
	Field camera
	Field score
	Field speed#
	Field health
	Field hit
	Field hit_time
	Field num_bullets
	Field mouse
End Type

Type city
	Field block_ent
	Field rb_ent
End Type

Global level.level = New level
Global scene.scene = New scene
Global player.player = New player
Global boss.boss = New boss
Global city.city = New city

light = CreateLight()
RotateEntity light, 30, 30, 0
player\ent = CreatePivot()

;put a tomak wrapper around the camera
 
;  box = CreateCube( player )
;  cameratomak = TOKRB_Create()
;  geom = TOKRB_AddBox( cameratomak,2.0,2.0,2.0)
;  TOKGEOM_SetMaterialIndex geom,1
;  TOKRB_SetPosition cameratomak,EntityX( player ) ,EntityY(player),EntityZ(player)
;  TOKRB_SetLinearDamping cameratomak,0.001
;  TOKRB_SetAngularDamping cameratomak,0.001	
;  TOKRB_SetMass cameratomak,2.0
;  TOKRB_SetBoxInertiaTensor cameratomak,2.0,1.0,1.0,2.0  
;  EntityColor box,Rnd(100,230),Rnd(100,230),Rnd(100,230) 

	;create rearview mirror
;	cam2 = CreateCamera( camera )
	;rotate it
;	RotateEntity cam2, 0,0,0
	;hide it
;	HideEntity p\cam2
	;specify viewport
;	CameraViewport cam2,10,335,160,110


player\camera = CreateCamera(player\ent)
CameraRange player\camera, .01, 2500
CameraClsColor player\camera, 108,122,255

;start with level 1
level\rb = 5
level\speed = 4
level\gun = 1
level\lev = 1
level\enemyhealth = 30
level\enemyhealth_org = 30
level\enemy_count_org = 5
level\force = 1000 ;2250
level\num_boss = 1
level\boss_size = 1
level\boss_mass = 6
level\enemy_count = 5
level\boss_vel = .1
level\city_size = 10
level\level_inc = 1.25
level\enemy_dist_shot = 5
level\boss_start_health = 100
level\boss_dead = 0

boss\hit = 0
level\boss_health = level\boss_start_health


;set up player
player\score = 0
player\speed# = .5
player\health = 100

;set up boss health
boss\health = level\boss_health

;get the sprite for the mouse
player\mouse = CreateSprite()

;create the first scene
create_scene()

;Create Level
create_level(  )

;create the player
create_player( ) 

;create the boss
create_boss()

;for some reason this needs to be here ???
EntityType scene\ground, LEVEL_COL


rot#=0

period=1000/FPS
time=MilliSecs()-period

imptime=MilliSecs()

While Not KeyHit(1) 						;ESC key
	Repeat
		elapsed=MilliSecs()-time
	Until elapsed

	ticks=elapsed/period
	tween#=Float(elapsed Mod period)/Float(period)

	For k=1 To ticks
		time=time+period
		If k=ticks Then CaptureWorld

		TOKSIM_Advance( 1.5/FPS ,1)
		
		camx#=Cos(rot#)*20
		camz#=Sin(rot#)*20
	Next


If rot#>360 Then rot#=0

;always reset the lightning
ResetLightning()
	
;how close is enemy?
enemy_distance()

;tomak
	For ob.objects = Each Objects
	    PositionEntity ob\obj,TOKRB_GetX#(ob\rb),TOKRB_GetY#(ob\rb),TOKRB_GetZ#(ob\rb) 
	    RotateEntity ob\obj,TOKRB_GetPitch#(ob\rb),TOKRB_GetYaw#(ob\rb),TOKRB_GetRoll#(ob\rb),False
	    If KeyDown(57) Then
	     TOKRB_ApplyImpulse2 ob\rb,Rnd(-.3,.3),Rnd(-1.5,3.0),Rnd(-.3,.3),Rnd(-.05,.05),Rnd(.05,.05),Rnd(-.05,.05)
	;	 TOKRB_ApplyImpulse2 cameratomak, Rnd(-.3,.3),Rnd(-1.5,3.0),Rnd(-.3,.3),Rnd(-.05,.05),Rnd(.05,.05),Rnd(-.05,.05)
	
		;if the block falls out of the zone - delete it
		If TOKRB_GetY( ob\rb ) < 0 Then
			TOKRB_Free ob\rb
	        FreeEntity ob\obj
			Delete ob
			
			;then take down the count
			level\enemy_count = level\enemy_count -1 
		End If
	
	    EndIf
	Next
;end tomak

  wkey = KeyDown(17)
  skey = KeyDown(31)
  akey = KeyDown(30)
  dkey = KeyDown(32)
  mouse1 = MouseHit(1)
  mouse2 = MouseHit(2)

  move=0
  If wkey Then 
	MoveEntity player\ent, 0, 0, eq(player\speed#)
	move=1
  End If
  If skey Then 
	MoveEntity player\ent, 0, 0, eq(-player\speed#)
	move=1
  End If
  If akey Then 
	MoveEntity player\ent, eq(-player\speed#), 0, 0
	move=1
  End If
  If dkey Then 
	MoveEntity player\ent, eq(player\speed#), 0, 0
	move=1
  End If

  TurnEntity player\ent, 0, Eq( -MouseXSpeed()/5.0 ), 0
  TurnEntity player\camera, Eq( MouseYSpeed()/5.0 ), 0, 0
  If EntityPitch( player\camera ) < -45
    RotateEntity player\camera, eq(-45), eq(EntityYaw( player\camera )), eq(EntityRoll( player\camera ) )
  EndIf 
  If EntityPitch( player\camera ) > 45					;don't allow camera to look above 45 degrees
    RotateEntity player\camera, 45, eq(EntityYaw( player\camera )), eq(EntityRoll( player\camera ))
  EndIf
  MoveMouse GraphicsWidth()/2, GraphicsHeight()/2		;reset mouse position to middle of screen

  TranslateEntity player\ent, 0, eq(-.1), 0				;simple gravity

  ;when the user moves - add a little bounce for the blocks
  If move=1 Then
	 For ob.objects = Each objects
	  TOKRB_ApplyImpulse ob\rb,0,.25,0
	 Next
	move=0
  End If


  If mouse1
	shoot( 1 )
  End If

  If mouse2
	shoot( 2 )
  End If

  For bullet.bullettype = Each bullettype			;iterate through all of the bullets
    PositionEntity bullet\tomak, TOKRB_GetX#(bullet\tomak_i) ,TOKRB_GetY#(bullet\tomak_i),TOKRB_GetZ#(bullet\tomak_i) 
    RotateEntity bullet\tomak,eq( TOKRB_GetPitch#(bullet\tomak_i) ),eq( TOKRB_GetYaw#(bullet\tomak_i) ),eq( TOKRB_GetRoll#(bullet\tomak_i) ),False

	;can we delete these bullets?
	;first check for bullet dead
	If bullet\dead Then
	  TOKRB_Free	bullet\tomak_i
      FreeEntity bullet\tomak		
      Delete bullet					
	End If
		
    If Abs(EntityX(bullet\tomak, 1)) > 1000	
	  TOKRB_Free	bullet\tomak_i
      FreeEntity bullet\tomak	
      Delete bullet				
    ElseIf Abs(EntityY( bullet\tomak, 1)) > 1000
	  TOKRB_Free	bullet\tomak_i
      FreeEntity bullet\tomak		
      Delete bullet						
    ElseIf Abs(EntityZ ( bullet\tomak, 1)) > 1000	
	  TOKRB_Free	bullet\tomak_i
      FreeEntity bullet\tomak
      Delete bullet						;delete the bullet
    EndIf
  Next


UpdateWorld							;figures out collisions



  For bullet = Each bullettype				
	coll = CountCollisions( bullet\tomak )
    If CountCollisions(bullet\tomak) > 0		
      enemyhit = EntityCollided(bullet\tomak, ENEMY_COL )	
      bos@#!*  = EntityCollided(bullet\tomak, BOSS_COL )
      If enemyhit > 0						

		 For ob.objects = Each objects
         If enemyhit = ob\obj	
			bullet\dead = 1
			player\score = player\score + 1
			;health of the enemy goes down by 10
			ob\health = ob\health - 10
           EndIf

			;while we're iterating - check their health
			If ob\health =< 0 Then
				TOKRB_Free	ob\rb
			    FreeEntity ob\obj
			    Delete ob
				level\enemy_count = level\enemy_count -1
			End If	
	     Next
	
      EndIf

		; did the boss get hit
		If bos@#!* > 0 Then
			level\boss_health = level\boss_health - 10
			boss\hit = 1

		End If 
    EndIf


	; after the collisions - check for death of the bullets
	If bullet\dead = 1 Then
  			  TOKRB_Free	bullet\tomak_i
    		  FreeEntity bullet\tomak			;delete the bullet mesh;
		      Delete bullet	
              player\num_bullets = player\num_bullets -1
	End If
	
  Next


	If KeyHit(57) Then
	 For ob.objects = Each objects
	  TOKRB_ApplyImpulse ob\rb,0,25,0
	;  TOKRB_ApplyImpulse cameratomak, 0,25,0
	 Next
EndIf

; check for bullets - can we delete idle ones?
check_bullets()

;still alive?
still_alive()

boss_update()

;equalize the speed for every computer - thanks John J.!
EqualizeSpeeds()
;EqualizeSpeeds()

RenderWorld tween							;draws the 3d scene
SetFont small
Color 255,255,255
Text 10, 10, "X: " + EntityX( player\ent )
Text 10, 20, "Y: " + EntityY( player\ent )
Text 10, 30, "Z: " + EntityZ( player\ent )
Text 10, 40, "Bullets Out: " + player\num_bullets
Text 10, 60, "Enemy Count: " + level\enemy_count
Text 10, 70, "Score: "  + player\score
Text 10, 80, "Player Health: " + player\health
Text 10, 90, "Boss Health: " + level\boss_health 

  Flip False								;displays the scene to the screen

Wend								;loop until the ESC key is pressed

For ob.objects = Each objects
  TOKRB_Free	ob\rb
  FreeEntity 	ob\obj
  Delete ob
Next 

For b.bullettype = Each bullettype
	  TOKRB_Free	b\tomak_i
	  FreeEntity b\tomak			;delete the bullet mesh
      Delete b	
Next

TOKSIM_DestroySimulator()
End

Function start_screen()

	SetBuffer(BackBuffer())
    SetFont big
	Color 0,128,255
	
	screen = GraphicsHeight()/2-90
	Repeat
		
		Text(GraphicsWidth()/2,screen,"Master Blaster",1)
		Text(GraphicsWidth()/2,screen+40,"Shoot everything - ",1)
		Text(GraphicsWidth()/2,screen+80,"...ha ha ha ha ha...",1)
		Text(GraphicsWidth()/2,screen+160,"press <space> to start",1)
		Flip()
	Until KeyDown(57)
	FlushKeys()

End Function

Function create_level(  )

For i=1 To level\rb
	ob.Objects = New Objects
	ob\obj = CreateCube()
	ScaleEntity ob\obj,1,0.5,0.5 
	;collision info
	EntityType ob\obj, ENEMY_COL
	EntityRadius ob\obj, .5, .95
	
	; end collision
	
	;id them
    ob\num = i
	ob\health = level\enemyhealth
	; end id

  ob\rb = TOKRB_Create()
  geom = TOKRB_AddBox( ob\rb ,2.0,1.0,1.0)
  TOKGEOM_SetMaterialIndex geom,1 
  TOKRB_SetPosition ob\rb,x#,2+i*0.2,z#
  TOKRB_SetLinearDamping ob\rb,0.001
  TOKRB_SetAngularDamping ob\rb,0.001	
  TOKRB_SetMass ob\rb,2.0
  TOKRB_SetBoxInertiaTensor ob\rb,2.0,1.0,1.0,2.0  
  TOKRB_SetCollisionID( ob\rb,ENEMY_COL)
  EntityColor ob\obj,Rnd(100,230),Rnd(100,230),Rnd(100,230) 

Next


End Function

Function start_level()

;clear the screen
Cls

; create the scene - depending on the level
; create the box
create_scene()

;create the player - depending on the level

;return and ready to rumble!

End Function

Function create_scene()

scene\ground = CreateCube()
EntityColor scene\ground,5,5,55 
ScaleEntity scene\ground,50,5,50 
;EntityType scene\ground, LEVEL_COL
PositionEntity scene\ground,0,-5,0
abground = TOKAB_Create()
TOKAB_AddBox(abground,100.0,10.0,100.0)
TOKAB_SetPosition(abground,0.0,-5.0,0.0)

scene\wall1 = CreateCube()
EntityColor scene\wall1,25,25,55 
ScaleEntity scene\wall1,2,10,50 
PositionEntity scene\wall1,50,0,0
EntityType scene\wall1, LEVEL_COL
abwall1 = TOKAB_Create()
TOKAB_AddBox(abwall1,4.0,20.0,100.0)
TOKAB_SetPosition(abwall1,50.0,0,0.0)

scene\wall2 = CreateCube()
EntityColor scene\wall2,25,25,55 
ScaleEntity scene\wall2,2,10,50 
EntityType scene\wall2, LEVEL_COL
PositionEntity scene\wall2,-50,0,0
abwall2 = TOKAB_Create()
TOKAB_AddBox(abwall2,4.0,20.0,100.0)
TOKAB_SetPosition(abwall2,-50.0,0,0.0)

scene\wall3 = CreateCube()
EntityColor scene\wall3,25,25,55 
EntityType scene\wall3, LEVEL_COL
ScaleEntity scene\wall3,50,10,2 
PositionEntity scene\wall3,0,0,-50
abwall3 = TOKAB_Create()
TOKAB_AddBox(abwall3,100.0,20.0,4.0)
TOKAB_SetPosition(abwall3,0.0,0,-50.0)

scene\wall4 = CreateCube()
EntityColor scene\wall4,25,25,55
EntityType scene\wall4, LEVEL_COL 
ScaleEntity scene\wall4,50,10,2 
PositionEntity scene\wall4,0,0,50
abwall4 = TOKAB_Create()
TOKAB_AddBox(abwall4,100.0,20.0,4.0)
TOKAB_SetPosition(abwall4,0.0,0,50.0)

draw_city()

End Function

Function create_player( )

	player\num_bullets = 0
	
	;right gun
	player\weapon1 = CreateCylinder(32, 1, player\camera)
	RotateMesh player\weapon1, 90, 0, 0
	ScaleEntity player\weapon1, .05, .05, .2
	EntityColor player\weapon1, 50, 50, 50
;	EntityType player\weapon1, PLAYER_COL
	
	;megaweapon - if we're on level 2
	If level\gun = 2 Then
		player\weapon2 = CreateCylinder( 32,1, player\camera)
		PositionEntity player\weapon2, -.45,-.20,.5
		RotateMesh player\weapon2, 90, 0,0
		ScaleEntity player\weapon2, .05,.05,.2
		EntityColor player\weapon2, 50,50,50
	End If
	
	MoveEntity player\camera, 0, .9, 0		
	MoveEntity player\weapon1, .1, -.15, .1	
	MoveEntity player\ent, 20, 1, -20		
	EntityType player\ent, PLAYER_COL		
	EntityRadius player\ent, .3, .95		


End Function

Function shoot( how )

	If how = 1 Then 
    bullet.bullettype = New bullettype				;create a bullet

	;1st bullet
	player\num_bullets = player\num_bullets + 1
	bullet\tomak = CreateSphere()
	bullet\dead = 0
	ScaleEntity bullet\tomak, .25, .25, .25
	EntityType bullet\tomak, BULLET_COL				
	EntityRadius bullet\tomak, .1, .95	
	bullet\tomak_i = TOKRB_Create()
	TOKRB_GravityEnable bullet\tomak_i, 1
	TOKRB_AddSphere bullet\tomak_i,.5
    TOKGEOM_SetMaterialIndex bullet\tomak_i,1 
	TOKRB_SetPosition bullet\tomak_i,EntityX( player\weapon1, 1), EntityY( player\weapon1, 1), EntityZ( player\weapon1, 1)
    TOKRB_SetAngularDamping bullet\tomak_i,0.002
    TOKRB_SetLinearDamping bullet\tomak_i,0.001 
    TOKRB_SetMass bullet\tomak_i,17.0 ; was 7
    TOKRB_SetSphereInertiaTensor bullet\tomak_i,2,2.0 
	TOKRB_SetCollisionID( bullet\tomak_i,BULLET_COL)
    EntityColor bullet\tomak,Rnd(100,230),Rnd(100,230),Rnd(100,230)


	amount#= level\force ;was 150
	TFormVector 0,0,1,player\camera,0
	TOKRB_ApplyImpulse bullet\tomak_i,TFormedX()*amount#,TFormedY()*amount#,TFormedZ()*amount#
	;second bullet - is there a second gun?
	If level\gun = 2 Then
		player\num_bullets = player\num_bullets + 1
	    bullet.bullettype = New bullettype				;create a bullet
		;2st bullet
		bullet\tomak = CreateSphere()
		bullet\dead = 0
		ScaleEntity bullet\tomak, .25, .25, .25
		EntityType bullet\tomak, BULLET_COL				
		EntityRadius bullet\tomak, .1, .95	
		bullet\tomak_i = TOKRB_Create()
		TOKRB_GravityEnable bullet\tomak_i, 1
		TOKRB_AddSphere bullet\tomak_i,.5
	    TOKGEOM_SetMaterialIndex bullet\tomak_i,1 
		TOKRB_SetPosition bullet\tomak_i,EntityX( player\weapon2, 1), EntityY( player\weapon2, 1), EntityZ( player\weapon2, 1)
	    TOKRB_SetAngularDamping bullet\tomak_i,0.002
	    TOKRB_SetLinearDamping bullet\tomak_i,0.001 
	    TOKRB_SetMass bullet\tomak_i,17.0 ; was 7
	    TOKRB_SetSphereInertiaTensor bullet\tomak_i,2,2.0 
		TOKRB_SetCollisionID( bullet\tomak_i,BULLET_COL)
	    EntityColor bullet\tomak,Rnd(100,230),Rnd(100,230),Rnd(100,230)
	
		amount#=level\force 
		TFormVector 0,0,1,camera,0
		TOKRB_ApplyImpulse bullet\tomak_i,TFormedX()*amount#,TFormedY()*amount#,TFormedZ()*amount#
	End If
	
	ElseIf how=2 Then ;shooting at the boss
	
	    bullet.bullettype = New bullettype				;create a bullet
		;1st bullet
		player\num_bullets = player\num_bullets + 1
		bullet\tomak = CreateSphere()
		bullet\dead = 0
		ScaleEntity bullet\tomak, .75, .75, .75
		EntityType bullet\tomak, BULLET_COL				
		EntityRadius bullet\tomak, .1, 2	
		bullet\tomak_i = TOKRB_Create()
		TOKRB_GravityEnable bullet\tomak_i, 1
		TOKRB_AddSphere bullet\tomak_i,2
	    TOKGEOM_SetMaterialIndex bullet\tomak_i,1 
		TOKRB_SetPosition bullet\tomak_i,EntityX( player\weapon1, 1), EntityY( player\weapon1, 1), EntityZ( player\weapon1, 1)
	    TOKRB_SetAngularDamping bullet\tomak_i,0.002
	    TOKRB_SetLinearDamping bullet\tomak_i,0.001 
	    TOKRB_SetMass bullet\tomak_i,57.0 ; was 7
	    TOKRB_SetSphereInertiaTensor bullet\tomak_i,2,57 
		TOKRB_SetCollisionID( bullet\tomak_i,BULLET_COL)
	    EntityColor bullet\tomak,Rnd(100,230),Rnd(100,230),Rnd(100,230)
		
		amount#= level\force*1.5 ;was 150
		TFormVector 0,0,1,player\camera,0
		TOKRB_ApplyImpulse bullet\tomak_i,TFormedX()*amount#,TFormedY()*amount#,TFormedZ()*amount#
	
	End If 


End Function

Function next_level()

	;give a few seconds to change
    Delay 3000

	Cls
	
	FlushKeys
	FlushMouse
	
	SetBuffer(BackBuffer())
	
	SetFont big
	Color 0,128,255
	
	screen = GraphicsHeight()/2-90
	
	Repeat
		Text(GraphicsWidth()/2,screen ,"Master Blaster- level " + level\lev,1)
		Text(GraphicsWidth()/2,screen +40,"Shoot everything - again!",1)
		Text(GraphicsWidth()/2,screen +80,"...ha ha ha ha ha...",1)
		Text(GraphicsWidth()/2,screen +160,"press <space> to start",1)
		Flip()
	Until KeyDown(57)
	FlushKeys()

	player\speed# = player\speed# + level\speed_adjustment#

	;update level attributes
	;start with level 1
	level\lev = level\lev + 1
	level\rb = level\rb * 1.5
	level\speed# = level\speed# * level\level_inc
	level\enemyhealth = level\enemyhealth * level\level_inc
	level\force = level\force * level\level_inc
	level\enemy_count = level\rb
	level\boss_vel = level\boss_vel * level\level_inc
	level\city_size = level\city_size * level\level_inc
	level\boss_mass = level\boss_mass * level\level_inc
	level\enemy_dist_shot = level\enemy_dist_shot * level\level_inc
	level\boss_health= level\boss_start_health * level\level_inc

	
	If level\lev => 4 Then
	level\gun = 2
	level\num_boss = 2
	level\boss_size = 2
	
	level\boss_dead = 0
	
	;with new guns - re-arm the player
	create_player()
	End If

	
	;destroy the old city
	
	destroy_city()
	
	;create the new city
	draw_city()
	
	create_level()
	
	If level\boss_dead = 1 Then
		create_boss()
		level\boss_dead = 0
	End If
	
End Function

Function still_alive()

;	ob.objects = New objects
;		If ob = Null Then
;			next_level()
;		End If

If level\enemy_count <= 0 Then
	next_level()
End If
			
;	 For ob.objects = Each objects
;		;if all the objects are gone - start a new level
;			If ob = Null Then
;				next_level()
;			End If
 ;    Next

End Function

Function create_boss()
;each level has one or more boses - they are big - massive creatures (well really spheres) that chase you

boss.boss = New boss

	x# = 0
	y# = 0
	z# = 0

	boss\vel# = level\boss_vel#
	boss\ent = CreateSphere()
	ScaleEntity boss\ent,level\boss_size, level\boss_size, level\boss_size
	;collision info
	EntityType boss\ent, BOSS_COL
	PositionEntity boss\ent, x#, y#+1, z#
	EntityRadius boss\ent, 1, 1
	EntityColor boss\ent, 255,255,255
	; end collision
	
	;id them
	boss\health = level\boss_start_health
	; end id
	
	;texture the boss
	testtex=CreateTexture(128,128)
;	SetBuffer TextureBuffer(testtex)
	For x=0 To 10 
	  Color 0,0,0
	  Plot 4+Rand(120),4+Rand(120)
	Next
	
;    SetBuffer BackBuffer()
;    EntityTexture boss\ent,testtex

  w=MeshWidth( boss\ent) * level\boss_size
  h=MeshHeight( boss\ent) * level\boss_size
  d=MeshDepth( boss\ent) * level\boss_size
 
  boss\rb = TOKRB_Create()
  geom = TOKRB_AddSphere( boss\rb, level\boss_size*2 )
  TOKRB_GravityEnable boss\rb, 1
  TOKGEOM_SetMaterialIndex geom,1 
  TOKRB_SetPosition boss\rb,x#,y#+1,z#
  TOKRB_SetLinearDamping boss\rb,0.002
  TOKRB_SetAngularDamping boss\rb,0.002	
  TOKRB_SetMass boss\rb, level\boss_mass
  TOKRB_SetSphereInertiaTensor boss\rb,level\boss_size,level\boss_mass 
  TOKRB_SetCollisionID( boss\rb, ENEMY_COL )
 

End Function

Function boss_update( )

;can't do this if the boss isn't alive!
If level\boss_health > 0 Then

	x# = EntityX(player\ent)
	y# = EntityY(player\ent)
	z# = EntityZ(player\ent)

		;vector to x,y,z
		
		dx#=(x-EntityX(boss\ent))
		dy#=(y-EntityY(boss\ent))
		dz#=(z-EntityZ(boss\ent))
		
		;length of vector
		
		l#=Sqr(dx*dx+dy*dy+dz*dz)
		
		;make the vector a unit vector, length = 1
		
		dx=dx/l
		dy=dy/l
		dz=dz/l
		
		;check if he is hit - if so - stop him
		If boss\hit = 0 Then
			TranslateEntity boss\ent,dx*boss\vel#,dy*boss\vel#,dz*boss\vel#
		Else
			boss\hit = 1
		End If

Else
	If level\boss_dead <= 0 Then ;only do this if boss isn't already dead
		;kill boss - add to score - 
		  TOKRB_Free	boss\rb
   		  FreeEntity boss\ent
	      Delete boss
    	  player\score = player\score + 100
		  level\boss_dead = 1
	End If
End If
		
End Function

Function check_bullets()
	For bullet.bullettype = Each bullettype
	;also while we're iterating, check to see if they're idle - if so - delete them
	If TOKRB_IsIdle( bullet\tomak_i ) Then
		  TOKRB_Free	bullet\tomak_i
   		  FreeEntity bullet\tomak			;delete the bullet mesh;
	      Delete bullet	
    	  player\num_bullets = player\num_bullets - 1
	End If
	Next 

	; if we have more than 10 bullets on the scene - start deleting
	If player\num_bullets >= 10 Then
	bullet.bullettype = First bullettype
	  TOKRB_Free	bullet\tomak_i
	  FreeEntity bullet\tomak			;delete the bullet mesh;
      Delete bullet	
   	  player\num_bullets = player\num_bullets - 1
	End If

End Function

Function draw_city()
;add these extra objects in
For i=1 To level\city_size

	c.city = New city
    c\block_ent =CreateCube()
   ;EntityTexture fillers(i),testtex
	scale_x# = Rand(5,10)
	scale_y# = Rand(10,25)
	scale_z# = Rand(5,10)
	x# = Rand(-40,40)
	y# = Rand(-40,40)
	z# = Rand(-40,40)
	
   ScaleEntity c\block_ent,scale_x#,scale_y#,scale_z#
   PositionEntity c\block_ent,x#,0,z#
   EntityType c\block_ent,LEVEL_COL

	;texture them
	testtex=CreateTexture(128,128)
	SetBuffer TextureBuffer(testtex)
	For x=0 To 100 
	  Color 193,193,0
	  Plot 4+Rand(120),4+Rand(120)
	Next
	
	SetBuffer BackBuffer()
	EntityTexture c\block_ent,testtex
	
     c\rb_ent = TOKRB_Create()
	 w=MeshWidth( c\block_ent )*scale_x
	 h=MeshHeight( c\block_ent )*scale_y
	 d=MeshDepth( c\block_ent )*scale_z

     geom = TOKRB_AddBox( c\rb_ent ,w*2,h*2,d*2 )
	 TOKGEOM_SetMaterialIndex geom,1 
	 TOKRB_SetPosition c\rb_ent ,x#,y#,z#
	 TOKRB_SetLinearDamping c\rb_ent ,0.001
	 TOKRB_SetAngularDamping c\rb_ent ,0.001	
	 TOKRB_SetMass c\rb_ent,2.0
	 TOKRB_SetBoxInertiaTensor c\rb_ent,2.0,1.0,1.0,2.0  
	 TOKRB_SetCollisionID( c\rb_ent ,LEVEL_COL )
	 EntityColor c\block_ent ,255,255,255 ;Rnd(100,230),Rnd(100,230),Rnd(100,230) 
	
Next


End Function

Function destroy_city()
	For c.city = Each city
	
	  TOKRB_Free c\rb_ent
      FreeEntity c\block_ent
      Delete c
		
	Next
	
	;destroy all the left over bullets
	For b.bullettype = Each bullettype
	  TOKRB_Free	b\tomak_i
	  FreeEntity b\tomak
      Delete b	
	Next
End Function

Function enemy_distance()

;can't do this if the boss isn't alive!
If level\boss_health > 0 Then
	;check the distance
	If EntityDistance( player\ent, boss\ent ) < level\enemy_dist_shot Then
			CreateLightning( boss\ent, player\ent, 10, .5 )
			
			;now I'm hit with that lightning - show red screen / and jolt
			CameraClsColor player\camera, 255,0,0
			TranslateEntity player\ent, eq(EntityX( player\ent )* .02 ) , eq(EntityY( player\ent ) * .02) , eq(EntityZ( player\ent ) * .02)
			
			;if i'm hit - then let the player recover - a few secs..
			player\hit = True
	End If
	
	If player\hit = True Then
		If player\hit_time <= 0 Then
			CameraClsColor player\camera, 108,122,255
			;if i'm hit - decrease health
			player\health = player\health - 10
			player\hit_time = 100
			player\hit = False
		Else
			player\hit_time = player\hit_time - 10
		End If
	End If
End If

	
End Function

Function CreateLightning( FromEntity, ToEntity, Parts, Deviation# )
;got this function from EdzUp
	Local DeviationEntity = CreatePivot()
	Local TargetEntity = CreatePivot()
	Local TE=CreatePivot()
	Local PartCount = 0
	
	PositionEntity DummyEntity, EntityX#( FromEntity ), EntityY#( FromEntity ), EntityZ#( FromEntity )
	PointEntity DummyEntity, ToEntity
	Range# = EntityDistance#( FromEntity, ToEntity )
	
	Division# = Range# / Parts
	
	PositionEntity DeviationEntity, EntityX#( FromEntity ), EntityY#( FromEntity ), EntityZ#( FromEntity )
	
	For PartCount = 0 To Parts-1
		PositionEntity TargetEntity, EntityX#( DummyEntity ), EntityY#( DummyEntity ), EntityZ#( DummyEntity )
		MoveEntity TargetEntity, 0, Rnd( Deviation# )-Rnd( Deviation# ), Rnd( Deviation# )-Rnd(Deviation#)

		Lightning.LightningType = New LightningType
		Lightning\Entity = CreateSight()

		PointEntity DeviationEntity, TargetEntity
		
		PositionEntity Lightning\Entity, EntityX#( Deviationentity ), EntityY#( Deviationentity ), EntityZ#( Deviationentity )
		RotateEntity Lightning\Entity, EntityPitch#( DeviationEntity ), EntityYaw#( DeviationEntity ), EntityRoll#( DeviationEntity )
		ScaleEntity Lightning\Entity, EntityDistance#( DeviationEntity, TargetEntity ), .02, 1
		TurnEntity Lightning\Entity, 0, 90, 0
		
		;move the deviationentity to the target
		PositionEntity DeviationEntity, EntityX#( TargetEntity, 1 ), EntityY#( TargetEntity, 1 ), EntityZ#( TargetEntity, 1 )
		MoveEntity DummyEntity, 0, 0, Division#

	Next

	PositionEntity TargetEntity, EntityX#( ToEntity ), EntityY#( ToEntity ), EntityZ#( ToEntity )

	Lightning.LightningType = New LightningType
	Lightning\Entity = CreateSight()

	PointEntity DeviationEntity, TargetEntity
		
	PositionEntity Lightning\Entity, EntityX#( Deviationentity ), EntityY#( Deviationentity ), EntityZ#( Deviationentity )
	RotateEntity Lightning\Entity, EntityPitch#( DeviationEntity ), EntityYaw#( DeviationEntity ), EntityRoll#( DeviationEntity )
	ScaleEntity Lightning\Entity, EntityDistance#( DeviationEntity, TargetEntity ), .02, 1
	TurnEntity Lightning\Entity, 0, 90, 0
	
	FreeEntity DeviationEntity
	FreeEntity TargetEntity
End Function

Function CreateSight()
	;by Zenith
    sprite=CreateMesh()
    he=CreateBrush(255,255,255)
    v=CreateSurface(sprite,he)
    FreeBrush he
    AddVertex ( v,0,1,0,1,0)  ; top left 0,1;1,0
    AddVertex ( v,1,1,0,0,0)   ; top right 1,1;1,1
    AddVertex ( v,0,-1,0,1,1) ; bottom left 0,0;,0,0
    AddVertex ( v,1,-1,0,0,1)  ; bottom right 1,0;0,1
    AddTriangle( v,0,1,2)
    AddTriangle( v,3,2,1)
	TurnEntity sprite,0,0,0
	EntityFX sprite,17
    Return sprite
End Function

Function ResetLightning()
	For Lightning.LightningType = Each LightningType
		If Lightning<>Null
			If Lightning\Entity<>0 Then FreeEntity Lightning\Entity
			Delete Lightning
		EndIf
	Next
End Function

Function EqualizeSpeeds()
	ms = MilliSecs()
	timestep# = (ms - prevmillisecs) * .01
	If timestep > 2 Then timestep = 0
	If timestep < 0 Then timestep = 0
	prevmillisecs = ms
End Function

Function Eq#(speed#)
	Return timestep * speed
End Function


sampyxis: post an .exe.

maybe with a 'theme' like '2D Game in a week' or 'RPG Game in a week'


Good idea, although RPG in a week might be pushing it, maybe an RPGesque game would be possible.

Ok - here it is:

http://www.kidsgamming.com/Community/Downloads/Downloads_GetFile.aspx?id=100

Hope this works - first time I've compiled with Tomak - I included the dll's for it - not sure if it's necessary...

Yea, RPG is a lot to chew on - but, doing themes would be fun.

Sledge: If you were using the EXE, that was my mistake - I forgot to upload the latest version in EXE format. I fixed several bugs since that old EXE file. Please try it again now - it shouldn't have that problem. Also, remember there is no team mode anymore - the equivelant is pressing space repeatedly until all your tanks come to help you out.

Update: Player now gets backup priority - you don't have to wait anymore for a tank to be "ready" when you call for backup.

sampyxis: when I run it the character moves off too one size and it gets stuck. It checked my joystick is correctly calibrated.

Grey Alien: I only put keyboard / mouse support in there - does blitz translate the mouse commands for keyboard support?

Same happened to me, sampyxis. I kept the key held down though and eventually got to move but it was exceptionally fast. Also, there was nothing to shoot.

Update: Pressing [Space] now brings up a command menu where you can give a variety of commands to your teammates, such as Retreat, Attack, Hold position, Request Reinforcements, etc.

There was a bug in in somewhere which (rarely) caused crashes. It occurs when it tries to delete a fragment mesh, when it has already been deleted somewhere! I can't understand this, because the only area in code that deletes entities blindly is the code that deletes buildings after they've been destroyed (which uses CollisionEntity() ). I've temporarily changed this to HideEntity, so hopefully the problem will be "patched" for now.

ah - darn it -

I do have a slow laptop - thnk that may be it?

Ok - maybe - it's that I should have used a float for the player speed ???

Anyway - I tried that - updated the code and the exe.

Hope that helps!

Thanks!

lol, the "Write A Game in 24 hours Contest!" has become a "Write a Game in 6 days contest" :-P

Well, if we need more than a week for this then at least we know that 'Write A Game in 1 week Contest' is also a doomed concept. :P

Another issue is whether one really needed a week for it to write.. what if I calculate all my images and include my texgen of 1700 lines.. that way, my images only need half a page of data.
I did write that texgen code long ago however..

What if someone already has a platformgame engine laying around, and only needs to add new gfx/music/maps etc.?

The problem is - a 24 hour competition like this needs advertising and a prize to encourage lots of entries. Even then, there's not much you can do in 24 hours.

What if someone already has a platformgame engine laying around, and only needs to add new gfx/music/maps etc.?

That's why contests usually advertise weeks before it starts, and only announce the subject the day it starts. For example, you might advertise that you are starting a competition in one month, and announce what the prizes are. Then, when the competition begins, you announce the subject (for example, "Tank games", "Flight simulators", "Racing games", etc.). This more specific you make the competition, the less probable cheating is and the easier judging is.

lol, the "Write A Game in 24 hours Contest!" has become a "Write a Game in 6 days contest" :-P

Maybe, but by 24 hours after I begun my tank game, it was pretty much completed, although it was much simpler than it is now (without player-to-AI orders, not-so-smart AI, only 2 tanks per team, etc.). Of course now it's been about 38 hours and my game is much improved. The problem with not announcing a competition before it begins is it makes it hard for new entries as the deadline approaches.

John J, I like the new squad commands, but my buddies don't
stay by my side at all anymore, and that's the only way to
do well.

Other than that, great work!

Ok, drew, I'll change it so that they won't leave until you say so.

Update: Now squad commands now do not "expire" when issued by the player. Also a misc. bug was fixed where AI speech was not properly displayed above the tank.




sampyxis: I think your problem can be fixed by using a equalization system. I use the delta-time technique, because it's quick and simple:
;Equalization
Global prevmillisecs, timestep#

Function EqualizeSpeeds()
	ms = MilliSecs()
	timestep# = (ms - prevmillisecs) * .01
	If timestep > 2 Then timestep = 0
	If timestep < 0 Then timestep = 0
	prevmillisecs = ms
End Function

Function Eq#(speed#)
	Return timestep * speed
End Function


Just call EqualizeSpeeds() every loop and use Eq() for every distance measure, like instead of this:
MoveEntity cam, 1, 0, 0
, do this:
MoveEntity cam, Eq(1), 0, 0

When you get the Eq() speeds the way you want them, your game will run almost exactly the same on any computer of any speed.

There are other more accurate (but slower) techniques like render tweening, but much more complex than simple delta-time technique.

Update: Fixed bug where squad commands were "expiring" when they weren't supposed to.

Frank: I get the feeling I'm "dominating" this topic with all my updates. Could you please announce a final deadline so I can just upload one final release without cluttering this thread up?

Yeah then everyone can post a final .exe. Maybe all the the final entries should go in the showcase?

Thanks John
I added the equalizing code. I love picking up bits of code like this - I'll re-do the exe too.

This is the first blitz code I've written that other people tried to run - this is all good info.

Thanks

Update: Pause key added (P).

Frank: I get the feeling I'm "dominating" this topic with all my updates. Could you please announce a final deadline so I can just upload one final release without cluttering this thread up?
Sorry, everyone, I was side-tracked with personal life issues. The 24 hours contest has obviously been extended to a 168 hour contest. This is too much fun, I have to let it run its course. Looks like we all have 2 days left!

Post your final game exe with FINAL RELEASE: LINK. I'll harvest the Final Releases and create thread in the showcase. What would be a good prize for the winner(s)?

"prize for the winner" = warm glowy feeling.

"prize for the winner"
smug_mode = True

:P

One more question, Frank: How will the items be judged? Will you be the judge or will you count votes?

Maybe a panel of non-entrants for example, me, Big10p and anyone else who wants to feel important ;-)

One more question, Frank: How will the items be judged?
Perhaps someone can host a poll?

/me puts my Simon Cowell face on. :P

This isn't fair. I entered when the contest was only supposed to be 24 hours, and now that it's a week, everyone else has had 6 more days to work on it than I did!

That's it, I'm updating my entry to take advantage of this extra time.
Here is my updated entry:

SeedRnd MilliSecs() 
N = Rand(1, 100)
Print "I'm thinking of a number between 1 and 100"
A$ = Input$("What number am I thinking of?")
Select A$ = N
   Case True  Print "You guessed correctly!" 
   Case False Print "You guessed wrong.  Stupid!  You're so stupid!"
End Select


Shawn,

You missed the randomly Print "You've had more time than me!"

IPete2.


/me puts my Simon Cowell face on. :P



Oh, so you were the bloke that had that experimental transplant operation I heard they were doing in France. How'd that go?

That's it, I'm updating my entry to take advantage of this extra time.
Here is my updated entry:


Yeah, figured I'd do the same.

AppTitle("Casino Simulator Deluxe V2.0")
Purse%=500
ThisBet%=5
ThisGame=0
While ThisBet<>0 And Purse > 0
	ThisGame=ThisGame+1
	Print "====================================================="
	Print "  Game:"+ThisGame+" Purse: $"+Purse%
	ThisBet = Int(Input("  How Much To Bet (Default $1, 0 to quit)?"))
	If ThisBet > 0 And ThisBet <= Purse Then
		Odds = Rnd(1,4)
		If Odds = 1 Then
			Print "****    You Win $"+(ThisBet)+"    ****"
			Purse = Purse + ThisBet
		ElseIf Odds = 2 Then
			Print "****    Draw!    ****"
		Else
			Print "****    You Loose $"+ThisBet+"    ****"
			Purse = Purse - ThisBet
		EndIf
	Else
		Print "  You Don't Have That Kind Of Cash!"		
	EndIf
Wend
Print "----------------------------------------------"
Print "You Walk Away With $"+Purse 
Print "--Press Any Key To Quit!--"
WaitKey()
End 


Two more days! I'm already 168 hours behind at the office.
;-)

Really - this was fun - but a weekend 'game in a day' would be much better on me.

Oh, so you were the bloke that had that experimental transplant operation I heard they were doing in France. How'd that go?
Went great, although, I'm now a woman. :)

that's clever Big10p as it was a *face* transplant.

Yes, a woman's face.

Simon Cowell is a woman?

but it takes more than a pretty face to make you a real woman ;-)

Simon Cowell is a woman?
Yes, yes she is. :P

but it takes more than a pretty face to make you a real woman ;-)
Well, I'm also developing breasts in my old age - does that count? :)

Update: Highscore system added. Option to restart game added. Minor bug fixes/tweaks. Now, keys 1-6 can be used to give orders at any time, and Space does not hide/show the orders menu.

FINAL RELEASE: TankBattle

FINAL RELEASE: c e l l u l a r

Well - I didn't have time after my speed fix (hopefully fixed it!) - so here's my final exe also.

My Final Release:
http://www.kidsgamming.com/Community/Downloads/Downloads_GetFile.aspx?id=100

sampyxis: when I press space to start I get hit by a white sphere and pushed to the back right corner of the map, eventually I can move, but it's a bit slow and the mouse turn is extremely slow. Also some of these spheres appear to flicker and appear in different places. sorry :-(

Grey Alien:
Thanks for the info - this would be my first game post - looks like I've got tons to learn.

I've added John J.'s equalizing code - (added it to a few more places) - not sure if that will fix it.

I'll take it over to the office this weekend and try it on a variety of pc's to see if I can pin-point the issue.

I'm using tomak, so that may have something to do with it (I've set the tomak update to work well with my computer here - so it may be really fast on a better computer.)

I've updated the exe, but not sure if it'll fix it.

Outside of this contest, I added sound - which with the tomak physics, makes it really fun and satisfying to blast the heck out of those little boxes.

;-)

sampyxis:
The slow mouse movement may be caused if you added the Eq() function to the mousemove functions. Mouse movements should not be equalized. This is because if your mouse moves 20 units right in 1 second, for example, it has moved 20 units, whether or not your game is running at 30 or 300 FPS.

Also, I've noticed the mouse movement seems rough. This could be caused if you're using integers instead of floats to store the mouselook speeds.

Also remember that Tokomak has it's own automatic equalization, so don't use Eq() when applying forces to objects, etc.

The main disadvantage I've found with this delta-time technique is the confusion of where to put it and where not to put it, although you get used to it over time. Generally, you should only use a Eq() function when adding to or subtracting from a value to move an object, like this:
MoveEntity ent, Eq(1), 0, 0
or
badguy\x# = badguy\x# + Eq(1)

, but not like this:
obj\speed# = Eq(1)
...
...
MoveEntity obj\ent, obj\speed#, 0, 0 ;Equalization is not applied when object is moved, but when speed is set


Thanks for all the info John
I'll look at all these issues this weekend.

I probably did get a little lazy in my data types.

Thanks John

Have all the FINAL RELEASES been turned in. If so its Voting time!

I've no time anymore to soup things up .. by the way who needs scores @ columnz anyway.. the only thing I'm interested in is surviving the game. :P

Frank Taylor: I guess it's voting time. Too bad there are only 4 entries :(

P.S. I think a seperate thread for voting would be better.

A next compo would better be a bit more restrictive, like a week time and only a certain gametype (to have situations which are better comparible). Or perhaps 2 compos: 2d and 3d. I'm completely not into 3d, but I like 2d/classic/80's a lot.. :P

CAST YOUR VOTES HERE!

Heres my votes:
1. Tank Battle by John J.
2. Columns by CS_TBL
3. Master Blaster by sampyxis
4. Avoider by Dark Half
5. Casino Simulator Deluxe by Dark Half
6. Psychic Simulator by sswift
7. c e l l u l a r by Frank Taylor

Here's my votes (not including my entries, of course):
1. c e l l u l a r by Frank Taylor
2. Avoider by Dark Half
3. Columns by CS_TBL
4. Master Blaster by sampyxis
5. Casino Simulator Deluxe by Dark Half
6. Psychic Simulator by sswift

ooh this is hard, don't wanna make enemies.

1. Tank Battle by John J.
2. c e l l u l a r by Frank Taylor
3. Columns by CS_TBL
4. Avoider by Dark Half
5. Master Blaster by sampyxis
6. Casino Simulator Deluxe by Dark Half
7. Psychic Simulator by sswift

Sorry, I have to disagree slightly

1. c e l l u l a r by Frank Taylor
2. Tank Battle by John J.
3. Avoider by Dark Half
4. Psychic Simulator by sswift
5. Casino Simulator Deluxe by Dark Half
6. Columns by CS_TBL
7. Master Blaster by sampyxis

Cellular was interesting to play. Original idea!

Tank battle would have gotten Number 1 if I could shoot. I couldnt get it to shoot, but it was a fun little game otherwise (moving around with sceenery)

Avoider was simple and had a bit of challenge to it.

Columns- I couldnt get it to run. Having to paste 2 parts together and not know if one just extended the other, I couldnt get it to run with an error on clientwidth()

Master Blaster- Couldnt get it to run. The most recent posting of the code (from what I could find) had an error @
bos@#!*  = EntityCollided(bullet\tomak, BOSS_COL )

After downloading the zip, which inclucded the Tokamak wrapper, felt it a bit out of the rules to use seperate files when the rules stated single file. Still couldnt try this game to see if it was any good.

Dark Half: I played CS_TBLs exe that someone hosted above.

Can't help having 2 parts .. the codebox doesn't allow more than x lines of code (or x characters)... but it's just a matter of copy/paste to blitzplus and run it.

Ahhh, Didnt know it was Blitzplus. That would explain the ClientWidth()

My bad

Woot! I placed above last place!

Master Blaster- Couldnt get it to run. The most recent posting of the code (from what I could find) had an error @...

I found that too, but fixed it. In the first place, you're not supposed to be trying the source - you may only judge on the final exe entries (if I'm not mistaken).

Also, regarding the bug about not being able to shoot, are you sure you tried my final EXE? I thought I had that bug fixed long ago.

I found that too, but fixed it. In the first place, you're not supposed to be trying the source - you may only judge on the final exe entries (if I'm not mistaken).



There are over 150 posts in here bro. I dont have time to sift through them all to find the final. The ones labeled Final were the ones I picked, for the rest, I just went to the most recent 'full' source I could find :-)

Rules:
Must be written with a Blitz Language.
Requires No External Media.
Single File.
Must be written within the 24hr window starting from this date - be honest.
Post code as entry.


Nothing about judging EXEs.....

Master Blaster - Please point me to the EXE in this case...

I'm sure Frank is up for throwing a much more official compo as well. As him and I were talking, we could automate the whole process and give everyone a good reason to code in a timely matter again.

There are over 150 posts in here bro. I dont have time to sift through them all to find the final. The ones labeled Final were the ones I picked, for the rest, I just went to the most recent 'full' source I could find :-)

I'm sorry, I was reffering to Master Blaster mainly, since he did post a final EXE. Most of the others didn't bother to enter in the finals, but they've received votes anyway.

Master Blaster - Please point me to the EXE in this case..


Well - I didn't have time after my speed fix (hopefully fixed it!) - so here's my final exe also.

My Final Release:
www.kidsgamming.com/Community/Downloads/Downloads_GetFile.aspx?id=100


Anyway, I still don't know who won the competition. It's surely over by now, isn't it?

I'm sure Frank is up for throwing a much more official compo as well. As him and I were talking, we could automate the whole process and give everyone a good reason to code in a timely matter again.

An automated system definitely would be nice. :)

We are all winners:)

I'll average out the scores and post shortly.