Päätinpä julkaista pienen räiskintäpeli-projektin. Pelissä pelataan sotilaalla joka taistelee ruudulle spawnaavia vihollisia vastaan. Peli vaikenee aina kun taso kasvaa ja pisteitä kertyy kun ampuu vihollisia. Ammuksiakin on rajallinen määrä, joten ei kannata räiskiä turhaan
Screenshot uudemmasta versiosta jossa on omat grafiikat Uudempaan versioon tulossa:
Vihollisten törmäykset keskenään ja pelaajaan(100%)
Parhaimman tuloksen tallennus(100%)
Uudet grafiikat(100%)
Lataa tästä uusin versio!
Ja latauslinkki(siis lähdekoodi)(alkuperäinen peli):
Code: Select all
Repeat
Text 0,0,"FULLSCREEN Y/N?"
If KeyHit(cbkeyY) Then
fullscreen=3
Exit
ElseIf KeyHit(cbkeyN) Then
fullscreen=1
Exit
EndIf
DrawScreen
Forever
SCREEN 800,600
SCREEN 800,600,0,cbsizable
SetWindow "Zombie Rampage",fullscreen
FrameLimit 50
highscore_file=OpenToEdit("highscore.dat")
highscore=ReadInt(highscore_file)
CloseFile highscore_file
Repeat
CenterText 400,10,"...:::<<<<<<<<<<<<<<<<<<<<<---Zombie Rampage--->>>>>>>>>>>>>>>>>>>>>:::..."
CenterText 400,70,">>1. Aloita peli<<"
CenterText 400,130,">>2. Tekijät<<"
CenterText 400,190,">>3. Ohjeet<<"
CenterText 400,250,">>4. Poistu<<"
Box 0,290,800,310,0
If KeyHit(cbkey1) Then Exit
If KeyHit(cbkey2) Then selection=1
If KeyHit(cbkey3) Then Selection=2
If KeyHit(cbkey4) Then End
If selection=1 Then
Text 0,300,"Tekijät:"
Text 0,340,"Ohjelmointi: Juho Taskila(R0z0r, F-Softwares)"
Text 0,360,"http://f-softwares.viuhka.fi"
Text 0,380,"Grafiikat: Coolbasicin oletusgrafiikoita"
Text 0,400,"Musiikit: Coolbasicin mukana tullut biisi"
ElseIf selection=2 Then
Text 0,300,"Ohjeet:"
Text 0,340,"Näppäimet:"
Text 0,360,"Liikkuminen WSAD, ampuminen hiiren vasen näppäin, lataaminen R"
Text 0,400,"Pelin tasot:"
Text 0,420,"Pelissä on 3 tasoa, ensimmäisellä tasolla on vain heikoimpia vihollisia, "
Text 0,440,"mutta tason kasvaessa viholliset voimistuvat."
Text 0,480,"Pelin extrat:"
Text 0,500,"pelikentälle ilmestyy ajoittain kahta erityyppistä extraa; healtpackeja ja ammuksia. "
Else
Text 0,300,"Piste-ennätys: "+highscore
EndIf
DrawScreen
Forever
'''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''LATAUKSET'''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''
Text 0,0,"Loading...":DrawScreen
//aseen ääni
GunSound=LoadSound("media\Gun 1.wav")
GunReload=LoadSound("media\pistol reload.wav")
//pelaaja
player=LoadObject("media\soldier.bmp",100)
//healtbat
healtbar=LoadImage("media\life.jpg")
//pitäähän pelissä vihollinen olla
enemy=LoadObject("media\guy.bmp",100)
enemy3=LoadObject("media\cow.bmp")
ShowObject enemy3,OFF
ShowObject enemy, OFF
//ja luotejakin
bullet=LoadObject("media\bullet.bmp")
ShowObject bullet, OFF
//sitten lippaita ettei panokset pääse loppumaan
capOBJ=LoadObject("media\bigbullet.bmp")
ShowObject capOBJ, OFF
healtOBJ=LoadObject("media\crosshair.bmp")
ShowObject healtOBJ, OFF
target=LoadObject("media\target.bmp")
// ukkelin stydeemit
healt=100
ammo=30
cap=5
//
level=1
pisteet=0
//piilotetaan hiiri
ShowMouse OFF
//Typet...
'...vihollisille
Type VIHUT
Field tyyppi
Field obj
Field healt
EndType
'...luodeille
Type BULLETS
Field obj
EndType
'...ja lippaille
Type ITEM
Field obj
Field Itype
EndType
music = PlaySound("media\SK_Battle2.mp3")
'''''''''''''''''''''''''''''''''''''''''''''
''''''''''' PELIN ALKU ''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''
Repeat
//tasot:
If pisteet>0 And pisteet<5000 Then level=1
If pisteet>5000 And pisteet<10000 Then level=2
If pisteet>10000 And pisteet<20000 Then level=3
If SoundPlaying(music)=0 Then music = PlaySound("media\SK_Battle2.mp3")
If Timer()>aika+random3 Then
vihollinen.VIHUT=New(VIHUT)
If level=1 Then vihutyyppi=1
If level=2 Then vihutyyppi=Rand(1,2)
If level=3 Then vihutyyppi=Rand(1,3)
If vihutyyppi=1 Then
vihollinen\tyyppi=1
vihollinen\obj=CloneObject(enemy)
vihollinen\healt=100
ElseIf vihutyyppi=2
vihollinen\tyyppi=2
vihollinen\obj=CloneObject(player)
vihollinen\healt=60
ElseIf vihutyyppi=3
vihollinen\tyyppi=3
vihollinen\obj=CloneObject(enemy3)
vihollinen\healt=260
EndIf
PositionObject vihollinen\obj,Rand(-370,370),Rand(-270,270)
RotateObject vihollinen\obj,Rand(0,360)
aika=Timer()
If level=1
random3=Rand(700,3000)
ElseIf level=2
random3=Rand(700,2000)
ElseIf level=3
random3=Rand(700,1300)
EndIf
EndIf
SetWindow "Zombie Rampage - Level "+level
'''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''' LIPPAAT JA MUUT ESINEET ''''''
'''''''''''''''''''''''''''''''''''''''''''''''
//jos 5-10 sek randomi kuluu niin spawnataan uus lipas
If Timer()>aika1+random Then
lipas.ITEM=New(ITEM)
lipas\obj=CloneObject(capOBJ)
lipas\Itype=1
PositionObject lipas\obj,Rand(-370,370),Rand(-270,270)
aika1=Timer()
random=Rand(5000,10000)
EndIf
If Timer()>aika2+random2
healtADD.ITEM=New(ITEM)
healtADD\obj=CloneObject(healtOBJ)
healtADD\Itype=2
PositionObject healtADD\obj,Rand(-370,370),Rand(-270,270)
aika2=Timer()
random2=Rand(10000,15000)
EndIf
//ulkoasu
Color cbwhite
Box 30,30,740,540,0
Text 0,10,"Ammukset: "+ammo+"/"+cap
Text 0,575,"Pisteet: "+pisteet
'''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''PELAAJA JUTUT'''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''
//jos ukko menee yli rajan niin pysäytetään
If ObjectX(player)>360 Then PositionObject player,360,ObjectY(player)
If ObjectX(player)<-360 Then PositionObject player,-360,ObjectY(player)
If ObjectY(player)>260 Then PositionObject player,ObjectX(player),260
If ObjectY(player)<-260 Then PositionObject player,ObjectX(player),-260
If healt<1 Then
highscore_file=OpenToRead("highscore.dat")
highscore=ReadInt(highscore_file)
CloseFile highscore_file
If pisteet>highscore Then
highscore_file=OpenToWrite("highscore.dat")
WriteInt highscore_file,pisteet
CloseFile highscore_file
EndIf
MakeError "Kuolit!"
EndIf
//healtbar
Color cblightgreen
Text 400,10,"Energia: "+healt
DrawImageBox healtbar,200,2,0,0,healt*2,26
//asetetaan tähtäin sinne missä hiiri on
PositionObject target, MouseWX(),MouseWY()
//osoitetaan pelaajalla tähtäintä
PointObject player,target
//ukon liikutus moveup muuttujalla ulös ja alas
If KeyDown(cbkeyW) Then
moveup=4
ElseIf KeyDown(cbkeyS) Then
moveup=-4
Else
moveup=0
EndIf
//ukon liikutus moveleft muuttujalla vasemmalle ja oikealle
If KeyDown(cbkeyD) Then
moveleft=4
ElseIf KeyDown(cbkeyA) Then
moveleft=-4
Else
moveleft=0
EndIf
//liikutetaan ukkoja muuttujien perusteella
TranslateObject player,moveleft,moveup
//ukon ampuminen
If MouseDown(1) And reload=0 And ammo=>1 Then
luoti.BULLETS=New(BULLETS)
luoti\obj=CloneObject(bullet)
//asetetaan luoti ukon kohdalle
CloneObjectPosition luoti\obj,player
//ja asetetaan samaan kulmaan
CloneObjectOrientation luoti\obj,player
reload=reloadspeed
PlaySound GunSound,50
ammo=ammo-1
EndIf
reload_bonus=False
If reload_bonus Then
reloadspeed=4
Else
reloadspeed=8
EndIf
If ammo=0 And cap>0 Then
If KeyHit(cbkeyR)Or MouseHit(2) Then
ammo=ammo+30
cap=cap-1
PlaySound GunReload
EndIf
Color cbred
Text 30,30,"LATAA R"
EndIf
If reload=>1 Then reload=reload-1
//
''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''Luotien hallinta'''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''
For luoti.BULLETS=Each BULLETS
MoveObject luoti\obj,15
If ObjectX(luoti\obj)>370 Or ObjectX(luoti\obj)<-370 Or ObjectY(luoti\obj)>270 Or ObjectY(luoti\obj)<-270 Then
DeleteObject luoti\obj
Delete luoti
EndIf
Next luoti
''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''Lippaiden hallinta'''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''
For lipas.ITEM=Each ITEM
If ObjectsOverlap(player,lipas\obj)
If lipas\Itype=1 Then
cap=cap+1
EndIf
If lipas\Itype=2 Then
healt=healt+20
EndIf
DeleteObject lipas\obj
Delete lipas
EndIf
Next lipas
''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''Vihollisten hallinta'''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''
For vihollinen.VIHUT=Each VIHUT
//piirretään vihulaisten healttibaari
Color cbred
DrawToWorld ON
Box ObjectX(vihollinen\obj)-20,ObjectY(vihollinen\obj)+32,vihollinen\healt/2,3
DrawToWorld OFF
If vihollinen\tyyppi=1 Then
MoveObject vihollinen\obj,2
//Jos vihu on pelaajan lähellä nii mennään sitä kohti
If Distance2(player,vihollinen\obj)<200
PointObject vihollinen\obj,player
Else
suunta=Rand(-20,20)
TurnObject vihollinen\obj,suunta
If ObjectX(vihollinen\obj)<-370 Or ObjectX(vihollinen\obj)>370 Or ObjectY(vihollinen\obj)<-270 Or ObjectY(vihollinen\obj)>270
TurnObject vihollinen\obj,50
MoveObject vihollinen\obj,4
EndIf
EndIf
//
ElseIf vihollinen\tyyppi=2
MoveObject vihollinen\obj,5
//Jos vihu on pelaajan lähellä nii mennään sitä kohti
If Distance2(player,vihollinen\obj)<400
PointObject vihollinen\obj,player
Else
suunta=Rand(-20,20)
TurnObject vihollinen\obj,suunta
If ObjectX(vihollinen\obj)<-370 Or ObjectX(vihollinen\obj)>370 Or ObjectY(vihollinen\obj)<-270 Or ObjectY(vihollinen\obj)>270
TurnObject vihollinen\obj,50
MoveObject vihollinen\obj,4
EndIf
EndIf
//
ElseIf vihollinen\tyyppi=3
MoveObject vihollinen\obj,1
//Jos vihu on pelaajan lähellä nii mennään sitä kohti
If Distance2(player,vihollinen\obj)<800
PointObject vihollinen\obj,player
Else
suunta=Rand(-20,20)
TurnObject vihollinen\obj,suunta
If ObjectX(vihollinen\obj)<-370 Or ObjectX(vihollinen\obj)>370 Or ObjectY(vihollinen\obj)<-270 Or ObjectY(vihollinen\obj)>270
TurnObject vihollinen\obj,50
MoveObject vihollinen\obj,4
EndIf
EndIf
//
EndIf
If ObjectsOverlap(vihollinen\obj,player) Then
If Timer()>hitTime+500
healt=healt-10
hitTime=Timer()
EndIf
EndIf
For luoti.BULLETS=Each BULLETS
If ObjectsOverlap(luoti\obj,vihollinen\obj)
vihollinen\healt=vihollinen\healt-20
DeleteObject luoti\obj
Delete luoti
EndIf
Next luoti
If vihollinen\healt=0 Then
DeleteObject vihollinen\obj
Delete vihollinen
If vihollinen\tyyppi=1
pisteet=pisteet+250
ElseIf vihollinen\tyyppi=2
pisteet=pisteet+500
ElseIf vihollinen\tyyppi=3
pisteet=pisteet+2500
EndIf
EndIf
Next vihollinen
DrawScreen
Forever
Oma ennätykseni pelissä on 41000 pistettä kun kerran kokeilin
Uusi latauslinkki http://darksidecoders.com/uploads/Zombi ... 0v.1.2.zip (lisännyt VesQ)