TGC Codebase Backup



2D Shootout by Anonymous Coder

2nd Aug 2006 6:08
Summary

In this simple Game you have got to kill as many insects as possible in the given time.



Description

All images are drawn ingame
You can change the blood-mode by pressing 1 or 2.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    REM Projekt: Mücken
REM erstellt: 05.04.2006
set display mode 1024,768,32 : hide mouse : sync on : randomize timer() : krank=0 : punkte=0 : t=timer()
type blut
x : y
endtype

type viech
x : y
tempo
tot : count : merker
links
endtype

rem Main
gosub aufbau
while timer()-t<60000
if krank=0 : cls : endif
gosub spiel
sync
endwhile
gosub ende

rem *****************************************
aufbau:
rem Mücke
ink rgb(140,100,255),0
for x=1 to 10 : ellipse 80,80,x,2*x : next x
ink rgb(50,50,50,),0
box 55,100,105,107
line 105,103,115,103
ink rgb(255,255,255),0
circle 103,100,2
get image 1,55,60,115,107
rem Klatsche
ink rgb(1,1,1),0
for i=0 to 50 step 10 : line 300,10+i,350,10+i : line 300+i,10,300+i,60 : next i
get image 2,300,10,350,60
rem Himmel+Erde
box 0,0,1024,350,rgb(0,0,255),rgb(0,0,200),rgb(0,0,255),rgb(0,0,200)
box 0,350,1024,768,rgb(0,180,0),rgb(0,255,0),rgb(0,180,0),rgb(0,255,0)
rem malen wir ein Haus :p
box 700,250,900,350,rgb(255,255,255),rgb(255,255,255),rgb(255,255,255),rgb(255,255,255)
ink rgb(255,0,0),0
for x=700 to 900
 line x,250,800,200
next x
get image 10,0,0,1024,768
cls
paste image 10,0,0
rem Daten........
anzahl=10 : blood=300 : merker=0
dim blut(blood*(anzahl+1)) as blut
dim viech(anzahl) as viech
for a=0 to anzahl
 viech(a).links=a mod 2
 viech(a).x=-60 + viech(a).links*1084
 viech(a).y=0+rnd(700)
 viech(a).tempo=1+rnd(10)*0.1+rnd(10)*0.1
 set sprite a+1,1,1
 if viech(a).links<>1 : mirror sprite a+1 : endif
next a
return
rem ****************************************************

spiel:
rem hintergrund
if krank=0 : paste image 10,0,0 : endif
ink rgb(255,255,0),0
set cursor 0,0 : print "Restzeit: "+str$(60-(timer()-t)/1000)+"   Punkte: "+str$(punkte)
rem biester malen, wenn sie noch leben
for a=0 to anzahl
if viech(a).tot<>1
show sprite a+1
rem Nach links fliegen
 if viech(a).links<>1
  if viech(a).x>-60 : viech(a).x=viech(a).x-viech(a).tempo
  else viech(a).x=1082 : viech(a).tempo=1+rnd(20)*0.1 : viech(a).y=100+rnd(600) : endif
 rem nach rechts fliegen
 else
  if viech(a).x<1024 : viech(a).x=viech(a).x+viech(a).tempo
  else viech(a).x=-60 : viech(a).tempo=1+rnd(20)*0.1 : viech(a).y=100+rnd(600) : endif
 endif
 rem sprite positionieren
 sprite a+1,viech(a).x,viech(a).y,1
rem gekillte darstellen
else
 lock pixels
 ink rgb(200+rnd(55),0,0),0
 if viech(a).merker<>1
  hide sprite a+1 : punkte=punkte+1
  for i=1 to 3 : box viech(a).x+rnd(10*i),viech(a).y+rnd(10*i),viech(a).x+30+rnd(10*i),viech(a).y+30+rnd(10*i) : next i
  for anz=0 to blood
   blut(anz+(a*blood)).x=viech(a).x+30+rnd(blood/7)*sin(winkel#)
   blut(anz+(a*blood)).y=viech(a).y+20+rnd(blood/7)*cos(winkel#)
   dot blut(anz+(a*blood)).x,blut(anz+(a*blood)).y
   winkel#=wrapvalue(winkel#+1)
  next anz
  viech(a).merker=1
 endif
 for bl=0 to blood
  blut(bl+(a*blood)).y=blut(bl+(a*blood)).y+rnd(10)
  dot blut(bl+(a*blood)).x,blut(bl+(a*blood)).y
  if blut(bl+(a*blood)).y>=768 : viech(a).count=viech(a).count+1 : endif
 next bl
 unlock pixels
 if viech(a).count>=blood
 if viech(a).links<>0 : viech(a).x=1085 : else : viech(a).x=-61 : endif
 viech(a).count=0 : viech(a).tot=0 : viech(a).merker=0 : endif

endif
next a

rem klatsche malen
sprite 12,mousex(),mousey(),2
rem klatschen ***************

if mouseclick() : klick=1 : endif
if klick=1 and mouseclick()=0
klick=0
for a=0 to anzahl
 if mousex()>viech(a).x and mousex()<viech(a).x+60 or mousex()+50>viech(a).x and mousex()+50<viech(a).x+60
  if mousey()>viech(a).y and mousey()<viech(a).y+47 or mousey()+50>viech(a).y and mousey()+50<viech(a).y+47
   viech(a).tot=1 : endif : endif
next a
endif



if inkey$()="1" : krank=0 : endif
if inkey$()="2" : krank=1 : endif

return
rem ****************************

ende:
for a=0 to anzahl : hide sprite a+1 : next a : cls
paste image 10,0,0
set text to bold
set text size 60
ink rgb(255,255,0),0
center text screen width()/2,100,"Punkte: "+str$(punkte)
sync
wait key
return