Kill teh Zombies (Beta 1.0)

Jaa meneillään olevat projektisi tai valmiit pelit muun yhteisön kanssa täällä.
Post Reply
User avatar
Alligaattori
Active Member
Posts: 135
Joined: Fri Mar 07, 2008 9:49 pm

Kill teh Zombies (Beta 1.0)

Post by Alligaattori » Mon Sep 15, 2008 6:55 pm

KillBurn wrote:Joo ei yhtään hyvä ollut.Grafiikka oli hirveää, haulikko näytti sorkkaraudalta ja zombiet pixeli litkuja. :cry:
Olen nyt itsekin samaa mieltä. Lukkoa.
Last edited by Alligaattori on Mon Sep 15, 2008 8:26 pm, edited 2 times in total.

User avatar
Ruuttu
Devoted Member
Posts: 687
Joined: Thu Aug 30, 2007 5:11 pm
Location: Finland, Sipoo

Re: Kill teh Zombies (Beta 1.0)

Post by Ruuttu » Mon Sep 15, 2008 7:16 pm

Joopa joo... Eli olet napannut Aavesoturin "3D -systeemin" ja lisännyt siihen vihollisia, jotka kaiken lisäksi (kuten sanoit) pomppivat ruudulla miten sattuu. Ja koska "grafiikkamoottorikin" on suhteellisen surkea (CB:llä ei juuri parempaan pysty), pelaaminen on visuaalisestikin aikamoista tuskaa. En oikein tiedä miksi tämä piti julkaista, pelaaminen ei ole erityisen hauskaa, ja se suurin osa pelistä ei ole itsesi tekemää. Toki vihollisten lisääminen koodiin on saattanut tavallaan olla haastavaa ja opettavaista (erittäin turhauttavaakin jos kolmiulotteisuusjutut eivät ole hanskassa), mutta tuota...

Yhteenvetona: En ymmärrä miksi tämä piti julkaista.

User avatar
Koodiapina
Forum Veteran
Posts: 2396
Joined: Tue Aug 28, 2007 4:20 pm
Contact:

Re: Kill teh Zombies (Beta 1.0)

Post by Koodiapina » Mon Sep 15, 2008 7:24 pm

Hieman samoilla linjoilla Ruutun kanssa, tästä paistaa hieman liikaa se, että ollaan käytetty CB:n Raycaster moottoria. Viholliset ja esineet skaalautuvat hieman rumahkosti ja pelattavuus on tosiaan vaikeahkoa. Kuitenkin ihan toimiva peli vaikka radan vaihdossa tulikin negatiivisen taulukon solun luku - virhe. Rataeditori on varmasti hienosti tehty, mutta ehkä parempi idea olisi tehdä noiden mappi filujen muokkauksesta ihan apuohjelma vaikkapa 2D:nä. Eli ruudulla näkyisi 2 uloitteisesti graaffisesti mihin halutaan zombieita ja mihin seiniä. Mukana voisi myös olla drag & drop.
Ruuttu wrote:Ja koska "grafiikkamoottorikin" on suhteellisen surkea (CB:llä ei juuri parempaan pysty)
Kyllä mun mielestä vanhoilta foorumeilta löytyvästä Shadow Squadista löytyy todella upeat tekstuurit eikä jää paljonkaan vanhoista klassikoista.
Last edited by Koodiapina on Mon Sep 15, 2008 7:26 pm, edited 1 time in total.
Olen liian älykäs ollakseni väärässä. Jos olet kanssani eri mieltä, suosittelen sinua pohtimaan omaa elämänkatsomustasi ja sen perusteita.

User avatar
Alligaattori
Active Member
Posts: 135
Joined: Fri Mar 07, 2008 9:49 pm

Re: Kill teh Zombies (Beta 1.0)

Post by Alligaattori » Mon Sep 15, 2008 7:26 pm

Kyllä, nappasin Aavesoturin 3D-enginen ja kasasin pelin siihen päälle. Tein toki kaikenlaista juttua itsekin. Laittelin viholliset ja pickupit, säädin vihulaissysteemin melkein toimivaksi, tein valikon jne. Etpä tiedä, millainen vaiva siinä oli. Lähinnä pelin julkaisun tarkoitus oli näyttää aloittelijoille, mitä cb:llä voi tehdä, vaikka nopeus ja grafiikka eivät ole päätä huimaavia.

Grandi: mappieditoria ei ole, mutta ajattelin tehdä sellaisen.
EDIT:

Yritän korjata tuon taulukon lukuongelman.


User avatar
KillBurn
Advanced Member
Posts: 339
Joined: Wed Aug 29, 2007 5:02 pm

Re: Kill teh Zombies (Beta 1.0)

Post by KillBurn » Mon Sep 15, 2008 8:11 pm

Joo ei yhtään hyvä ollut.Grafiikka oli hirveää, haulikko näytti sorkkaraudalta ja zombiet pixeli litkuja. :cry:
Sumu Games: Sam, Ur eye!

User avatar
Alligaattori
Active Member
Posts: 135
Joined: Fri Mar 07, 2008 9:49 pm

Re: Kill teh Zombies (Beta 1.0)

Post by Alligaattori » Mon Sep 15, 2008 8:26 pm

KillBurn wrote:Joo ei yhtään hyvä ollut.Grafiikka oli hirveää, haulikko näytti sorkkaraudalta ja zombiet pixeli litkuja. :cry:
Olen nyt itsekin samaa mieltä. Lukkoa.

User avatar
MaGetzUb
Guru
Posts: 1715
Joined: Sun Sep 09, 2007 12:35 pm
Location: Alavus

Re: Kill teh Zombies (Beta 1.0)

Post by MaGetzUb » Tue Sep 16, 2008 4:45 pm

Olisi nyt ees ollu tähän päivään asti ladattavissa. :x Nii ois voinu testata, valituksista huolimatta.
Solar Eclipse
Meneillä olevat Projektit:
We're in a simulation, and God is trying to debug us.

User avatar
kaneli2000
Guru
Posts: 1059
Joined: Mon Mar 17, 2008 3:40 pm
Location: Lempäälä

Re: Kill teh Zombies (Beta 1.0)

Post by kaneli2000 » Wed Sep 17, 2008 9:40 pm

Pistäkääs nyt hei lataukseen, ihmiset haluu nähä tän pelin, ainakin kaksi (minä ja programmeri)!

User avatar
nevssons
Devoted Member
Posts: 503
Joined: Sun Jan 13, 2008 6:02 pm

Re: Kill teh Zombies (Beta 1.0)

Post by nevssons » Wed Sep 17, 2008 9:43 pm

kaneli2000 wrote:Pistäkääs nyt hei lataukseen, ihmiset haluu nähä tän pelin, ainakin kaksi (minä ja programmeri)!
Ainakin kolme! (minäkin haluaisin nähdä!)

___________________
Join the revolution

User avatar
MAVmaggot
Advanced Member
Posts: 468
Joined: Fri Aug 31, 2007 10:18 pm
Location: bitspace

Re: Kill teh Zombies (Beta 1.0)

Post by MAVmaggot » Wed Sep 17, 2008 9:44 pm

kröhöm, 4. (editoin sit)

User avatar
MaGetzUb
Guru
Posts: 1715
Joined: Sun Sep 09, 2007 12:35 pm
Location: Alavus

Re: Kill teh Zombies (Beta 1.0)

Post by MaGetzUb » Wed Sep 17, 2008 9:50 pm

Noni alkoha niitä ihmisiä tulla protestoimaan. Sitä paitsi ei noita projekteja noin vain "repäistä" pois latauksesta, sitten vaan kun on jo vähän hiljaista. ;)

Bajaxo_guest

Re: Kill teh Zombies (Beta 1.0)

Post by Bajaxo_guest » Thu Sep 18, 2008 10:52 am

5. joka haluaisi nähdä pelin.

User avatar
MAVmaggot
Advanced Member
Posts: 468
Joined: Fri Aug 31, 2007 10:18 pm
Location: bitspace

Re: Kill teh Zombies (Beta 1.0)

Post by MAVmaggot » Thu Sep 18, 2008 7:22 pm

Voit olla antamatta peliä meille, mutta se ei tee maineellesi hyvää. Tai sitten olet mies, ja laitat sen tänne, on se kuinka paska hyvänsä.

User avatar
Dande
Active Member
Posts: 193
Joined: Tue Aug 28, 2007 4:30 pm

Re: Kill teh Zombies (Beta 1.0)

Post by Dande » Thu Sep 18, 2008 7:50 pm

Paljastakaamme nyt tämä alligaattorin pois levityksestä vetämä peli, jonka vielä löysin lataamistani tiedostoista: http://up.servut.us/10279

User avatar
MAVmaggot
Advanced Member
Posts: 468
Joined: Fri Aug 31, 2007 10:18 pm
Location: bitspace

Re: Kill teh Zombies (Beta 1.0)

Post by MAVmaggot » Thu Sep 18, 2008 8:02 pm

Kiitti galgoneer, mut nyt jäi alligaattorin miehuuskoe kesken :D editoin kohta.
Edit:
Kohta tulikin vähän myöhemmin :) No kummiskin; itseni mielestä ei peli ollut mitenkään huono. Ukot olivat ihan selvät niin kuin maastokin, mutta ei silti innostanut mitenkään kauheasti pelaamaan. En sitten teidä millanen se marcoderin esimerkki oli, vaikka olisi tämä ollut vain klooni siitä.

User avatar
Alligaattori
Active Member
Posts: 135
Joined: Fri Mar 07, 2008 9:49 pm

Re: Kill teh Zombies (Beta 1.0)

Post by Alligaattori » Sun Sep 28, 2008 9:07 am

Jos jotain kiinnostaa, julkistan pelin koodin.

Code: Select all

SetWindow "Kill teh Zombies"

If Not Bin(Crc32("data\zeats.wav")) = "00110001010000000101111100001101" Then MakeError "DATA\ZEATS.WAV has been corrupted. Try to reinstall the program."

If Not Bin(Crc32("data\gunshot.wav")) = "11100100011110100101011110000111" Then MakeError "DATA\GUNSHOT.WAV has been corrupted. Try to reinstall the program."

SAFEEXIT OFF

Const SOME_VALUE = 2.5

Const POINTSIGHT_TARKKUUS = 2

Const PROJECTION_FACTOR = 100
Const DISTFACTOR = 1

Const SCRNWIDTHD2 = 320
Const SCRNHD2 = 240

Const SCRNWIDTH = 640
Const SCRNH = 480

Const COLOR_RED = 0
Const COLOR_WHITE = 1
Const COLOR_GREY = 2
Const COLOR_YELLOW = 3

ChDir "data"

SCREEN 640,480,16,0

ClearArray OFF

MENUMUSICCOUNT = -1
BATTLEMUSICCOUNT = -1

Dim BATTLEMUSICS(0,1)
Dim MENUMUSICS(0,1)

StartSearch
    Repeat
        foundfile$ = Lower(FindFile())
        If foundfile="" Then Exit

        p$ = Right(foundfile,4)
        
        Select p
            Case ".mod",".s3m"
                If Left(foundfile,6) = "battle" Then    
                    BATTLEMUSICCOUNT + 1
                    ReDim BATTLEMUSICS(BATTLEMUSICCOUNT,1)
                    BATTLEMUSICS(BATTLEMUSICCOUNT,0) = Int(Mid(foundfile,7,1))
                    If p=".s3m" Then
                        BATTLEMUSICS(BATTLEMUSICCOUNT,1) = 1
                    Else
                        BATTLEMUSICS(BATTLEMUSICCOUNT,1) = 0                        
                    End If
                ElseIf Left(foundfile,4) = "menu" Then
                    MENUMUSICCOUNT + 1
                    ReDim MENUMUSICS(MENUMUSICCOUNT,1)
                    MENUMUSICS(MENUMUSICCOUNT,0) = Int(Mid(foundfile,5,1))
                    If p=".s3m" Then
                        menuMUSICS(menuMUSICCOUNT,1) = 1
                    Else
                        menuMUSICS(menuMUSICCOUNT,1) = 0                        
                    End If
                End If
            Default
                p = Right(foundfile,3)
                Select p
                    Case ".xm",".it"
                        If Left(foundfile,6) = "battle" Then
                            BATTLEMUSICCOUNT + 1
                            ReDim BATTLEMUSICS(BATTLEMUSICCOUNT,1)  
                            BATTLEMUSICS(BATTLEMUSICCOUNT,0) = Int(Mid(foundfile,7,1))
                            If p=".xm" Then
                                BATTLEMUSICS(BATTLEMUSICCOUNT,1) = 2
                            Else
                                BATTLEMUSICS(BATTLEMUSICCOUNT,1) = 3                        
                            End If
                        ElseIf Left(foundfile,4) = "menu" Then
                            MENUMUSICCOUNT + 1
                            ReDim MENUMUSICS(MENUMUSICCOUNT,1) 
                            MENUMUSICS(MENUMUSICCOUNT,0) =Int(Mid(foundfile,5,1))
                            If p=".xm" Then
                                menuMUSICS(menuMUSICCOUNT,1) = 2
                            Else
                                menuMUSICS(menuMUSICCOUNT,1) = 3                        
                            End If
                        End If
                End Select
        End Select
    Forever
EndSearch

If Not FileExists("..\settings.ini") Then
    _det=1
    snd=1
    KEY_FWD = 17
    KEY_BACK = 31
    KEY_LEFT = 30
    KEY_RIGHT = 32
    
    Gosub WriteSettings
    
    Goto asd0051
End If

sett = OpenToRead("..\settings.ini")
    While Not EOF(sett)
        read_line$=ReadLine(sett)
        Select Upper(Trim(GetWord(read_line,1,"=")))
            Case "DETAIL_LEVEL"
                _det = Int(Upper(Trim(GetWord(read_line,2,"="))))
            Case "SOUNDS"
                snd = Int(Upper(Trim(GetWord(read_line,2,"="))))
            Case "KEY_FWD"
                KEY_FWD = Int(Upper(Trim(GetWord(read_line,2,"="))))
            Case "KEY_BACK"
                KEY_BACK = Int(Upper(Trim(GetWord(read_line,2,"="))))
            Case "KEY_RIGHT"
                KEY_RIGHT = Int(Upper(Trim(GetWord(read_line,2,"="))))
            Case "KEY_LEFT"
                KEY_LEFT = Int(Upper(Trim(GetWord(read_line,2,"="))))
        End Select
    Wend
CloseFile sett

asd0051:

Locate 50,50

Color cbRed
Write "Loading: |"

Color cbBlack

For i=1 To 35
    Write "|"
Next i

Color cbRed
Write "|"
Locate 50,50

Dim FontData(256) As Byte
Global font
Global LastTextWidth
Gosub Load_font

Color cbRed

Write "Loading: |"

Color cbWhite

Write "|"

DefaultMask ON,cbWhite

Include "d:\program files\coolbasic\sdk\include\cbMotion.cb"
Include "d:\program files\coolbasic\sdk\include\cbMath.cb"
Include "d:\program files\coolbasic\sdk\include\cbGraphics.cb"

Type BOT
    Field x#
    Field y#
    Field hp
    Field chnlGRR
    Field chnlWALK
    Field toWayPoint
End Type

Type BLOODEFFECT
    Field x#
    Field y#
    Field frame#
End Type

Type BULLETPACK
    Field x#
    Field y#
End Type

Type HPPACK
    Field x#
    Field y#
End Type

Dim WAYPOINTS(0) As Integer
Global WAYPOINTCOUNT
WAYPOINTCOUNT=0

Type WAYPOINT
    Field x
    Field y
    Field p1
    Field p2
    Field p3
    Field p4
    Field pc
End Type

Dim wp.WAYPOINT

Dim reload As Float
Global __walk As Float

Dim HP As Integer
Dim AMMO As Integer

Dim imgASE(2)

imgASE(0) = LoadImage("gun1.png")
imgASE(1) = LoadImage("gun2.png")
imgASE(2) = LoadImage("gun3.png")

imgMENU = LoadImage("menu.png")
imgCUR = LoadImage("cursor.png")
imgFLAME = LoadImage("flame.png")

imgZOMBIE = LoadImage("zombie.png")

ORIGINALZOMBIEW = ImageWidth(imgZOMBIE )
ORIGINALZOMBIEH = ImageHeight(imgZOMBIE )

imgHPPACK = LoadImage("hppack.png")
imgBULLETS = LoadImage("bullets.png")

Dim imgHITAREA(1)

imgHITAREA(0) = LoadImage("zhit.png")
imgHITAREA(1) = CloneImage(imgHITAREA(0))
ResizeImage imgHITAREA(1),-ImageWidth(imgHITAREA(1)),ImageHeight(imgHITAREA(1))

Dim hitamounts(15) As integer

hit = OpenToRead("zhit.dat")
    For i=0 To 15
        hitamounts(i) = ReadByte(hit)
    Next i
CloseFile hit

Dim zombies(31,1)
Dim blood(31)
Dim hppacks(31)
Dim bulletpacks(31)

Write "|"

For i=0 To 31
    temp = CloneImage(imgZOMBIE)
    ResizeImage temp,5(i+1),10(i+1)
    zombies(i,0) = temp
    
    HotSpot zombies(i,0),ImageWidth(zombies(i,0))/2,ImageHeight(zombies(i,0))/2
    
    temp = CloneImage(temp)
    ResizeImage temp,-ImageWidth(temp),ImageHeight(temp)
    zombies(i,1) = temp
    
    HotSpot zombies(i,1),ImageWidth(zombies(i,1))/2,ImageHeight(zombies(i,1))/2

    temp = CloneImage(imgHPPACK)
    ResizeImage temp,2(i+1),2(i+1)
    hppacks(i) = temp
    
    HotSpot hppacks(i),ImageWidth(hppacks(i))/2,ImageHeight(hppacks(i))/2
    
    temp = CloneImage(imgBULLETS)
    ResizeImage temp,2(i+1),2(i+1)
    bulletpacks(i) = temp
    
    HotSpot bulletpacks(i),ImageWidth(bulletpacks(i))/2,ImageHeight(bulletpacks(i))/2
    
    Write "|"
Next i

Dim colors(16,2)

file = OpenToRead("walls.dat")

For i=0 To 16
    colors(i,0) = ReadByte(file)
    colors(i,1) = ReadByte(file)
    colors(i,2) = ReadByte(file)
Next i

CloseFile file

Dim frameASE As Integer
Dim timerASE As Integer

Global sndWALK
sndWALK = LoadSound("walk2.wav")
sndGUN = LoadSound("gunshot.wav")
sndGRR = LoadSound("zeats.wav")
sndDEATH = LoadSound("zdeath.wav")
sndOUCH = LoadSound("zhurt.wav")
sndPICKUP = LoadSound("pick.wav")

Dim level(99,99) As String
Dim maprow(99) As String

Dim temp123123(1) As integer

halfh = SCRNHD2
Dim x As Float, y As Float, tempx As Float, tempy As Float
Dim dir As Float, tempdir As Float, amount As Float, rot As Float
Dim char As String
amount = .05: rot = 5: map = 1

CHARH = FontData(256)

snd = 1
_map$ = ""

chk = 0

Write "|"

Cls

menu:

PositionMouse 320,64

If snd And SoundPlaying(chnlMUSIC) Then StopSound chnlMUSIC

mus1 = MENUMUSICS(Rand(0,MENUMUSICCOUNT),0)
mus2 = MENUMUSICS(Rand(0,MENUMUSICCOUNT),1)

Select mus2
    Case 0
        mus3$ = "mod"
    Case 1
        mus3$ = "s3m"
    Case 2
        mus3$ = "xm"
    Case 3
        mus3$ = "it"
End Select

If snd Then chnlMUSIC = PlaySound("menu"+Str(mus1)+"."+mus3)

Color 192,192,192

ChDir "..\maps"
StartSearch

If chk=0 Then
    asd0039:
    foundfile$ = FindFile()
    
    If foundfile$="" Then EndSearch:StartSearch:Goto asd0039
    If Not Lower(Right(foundfile,4))=".txm" Then Goto asd0039
    
    _map$ = foundfile
    chk=1
End If

Repeat

    DrawImage imgMENU,0,0
    
    Select MENUSTATE
        Case 0
            TextOut( 320-TextWidth2("Play")/2,240-TextHeight2("")/2,"Play",COLOR_GREY)
            TextOut( 320-TextWidth2("Settings")/2,300-TextHeight2("")/2,"Settings",COLOR_GREY)
            TextOut( 320-TextWidth2("Help")/2,360-TextHeight2("")/2,"Help",COLOR_GREY)
            TextOut( 320-TextWidth2("Quit")/2,420-TextHeight2("")/2,"Quit",COLOR_GREY)
            
            If MouseHit(1) Then
                If     pointinbox(MouseX(),MouseY(),320-TextWidth2("Play")/2,240-TextHeight2("")/2,TextWidth2("Play"),TextHeight2("")) Then
                    Exit
                ElseIf pointinbox(MouseX(),MouseY(),320-TextWidth2("Settings")/2,300-TextHeight2("")/2,TextWidth2("Settings"),TextHeight2("")) Then
                    MENUSTATE = 1
                ElseIf pointinbox(MouseX(),MouseY(),320-TextWidth2("Help")/2,360-TextHeight2("")/2,TextWidth2("Help"),TextHeight2("")) Then
                    Execute("..\readme.html")
                ElseIf pointinbox(MouseX(),MouseY(),320-TextWidth2("Quit")/2,420-TextHeight2("")/2,TextWidth2("Quit"),TextHeight2("")) Then
                    End
                End If
            End If
        Case 1
            TextOut( 320-TextWidth2("Change map ("+_map$+")")/2,              240-CHARH/2,"Change map ("+_map$+")",COLOR_GREY)
            TextOut( 320-TextWidth2("Change detail level ("+Str3(_det)+")")/2,300-CHARH/2,"Change detail level ("+Str3(_det)+")",COLOR_GREY)
            TextOut( 320-TextWidth2("Sounds ("+Str2(snd)+")")/2,              360-CHARH/2,"Sounds ("+Str2(snd)+")",COLOR_GREY)
            TextOut( 320-TextWidth2("Change keys")/2,                         420-CHARH/2,"Change keys",COLOR_GREY)
            TextOut( 10,470-CHARH,"<< Back",COLOR_GREY)
            
            If MouseHit(1) Then
                If pointinbox(MouseX(),MouseY(),320-TextWidth2("Change map ("+_map$+")")/2,240-TextHeight2("")/2,TextWidth2("Change map ("+_map$+")"),TextHeight2("")) Then
                    asd0031:
                    
                    foundfile$ = FindFile()
                    
                    If foundfile$="" Then EndSearch:StartSearch:Goto asd0031
                    If Not Lower(Right(foundfile,4))=".txm" Then Goto asd0031
                    
                    _map$ = foundfile$
                    
                ElseIf pointinbox(MouseX(),MouseY(),320-TextWidth2("Change detail level ("+Str3(_det)+")")/2,300-TextHeight2("")/2,TextWidth2("Change detail level ("+Str3(_det)+")"),TextHeight2("")) Then
                    _det-1
                    If _det<1 Then _det=3
                ElseIf pointinbox(MouseX(),MouseY(),320-TextWidth2("Sounds ("+Str2(snd)+")")/2,360-TextHeight2("")/2,TextWidth2("Sounds ("+Str2(snd)+")"),TextHeight2("")) Then
                    snd=Not snd
                    If snd Then
                        chnlMUSIC = PlaySound("music2.xm")
                    Else
                        If SoundPlaying(chnlMUSIC) Then StopSound chnlMUSIC
                    End If
                ElseIf pointinbox(MouseX(),MouseY(),320-TextWidth2("Change keys")/2,420-TextHeight2("")/2,TextWidth2("Change keys"),TextHeight2("")) Then
                    menustate = 2
                ElseIf pointinbox(MouseX(),MouseY(),10,470-CHARH,TextWidth2("<< Back"),CHARH) Then
                    Gosub WriteSettings
                    menustate = 0
                End If
            End If
        Case 2
            TextOut( 320-TextWidth2("Press key: walk forward")/2,240-CHARH/2,"Press key: walk forward" ,COLOR_GREY)
            DrawScreen:key = WaitKey()
            KEY_FWD = key
            
            DrawImage imgMENU,0,0
            TextOut( 320-TextWidth2("Press key: walk back")/2,240-CHARH/2,"Press key: walk back" ,COLOR_GREY)
            DrawScreen:key = WaitKey()
            KEY_BACK = key
            
            DrawImage imgMENU,0,0
            TextOut( 320-TextWidth2("Press key: walk left")/2,240-CHARH/2,"Press key: walk left" ,COLOR_GREY)
            DrawScreen:key = WaitKey()
            KEY_left = key
            
            DrawImage imgMENU,0,0
            TextOut( 320-TextWidth2("Press key: walk right")/2,240-CHARH/2,"Press key: walk right" ,COLOR_GREY)
            DrawScreen:key = WaitKey()
            KEY_right = key
            
            MENUSTATE = 1
    End Select

    DrawImage imgCUR,MouseX(),MouseY()
    
    DrawScreen
Forever

EndSearch
ChDir "..\data"

SelectMap:
LoadTXM("..\maps"+Chr(92)+_map$)
Goto transfermap

GAME:
xtimer = -1

If snd And SoundPlaying(chnlMUSIC) Then StopSound chnlMUSIC

mus1 = battleMUSICS(Rand(0,battleMUSICCOUNT),0)
mus2 = battleMUSICS(Rand(0,battleMUSICCOUNT),1)

Select mus2
    Case 0
        mus3$ = "mod"
    Case 1
        mus3$ = "s3m"
    Case 2
        mus3$ = "xm"
    Case 3
        mus3$ = "it"
End Select

If snd Then chnlMUSIC = PlaySound("battle"+Str(mus1)+"."+mus3)

_error = SetError(0)*(__walk>0)
__error = SetError(1)*(__walk>0)

tim = Timer()
z_walk = 0

HP = 75
AMMO = 16

APPTIMER = 0

PositionMouse SCRNWIDTHD2, SCRNHD2
Gosub Renderer
Repeat
     
    UpdateFrameTimer()
    FT# = FrameTime()
    
    BULLETSHOT = False
    
    amount = FT/4.0*5.0

    If Timer()-tim > 500 Then tim = Timer() : z_walk = Not z_walk
    
    Mouse_Hit = MouseHit(1) * (xtimer=-1)
    
    _error = SetError(0)*(__walk>0)
    __error = SetError(1)*(__walk>0)

If xtimer = -1 Then    

    If KeyDown(KEY_FWD) Then tempdir = dir: move = True 
    If KeyDown(KEY_BACK) Then tempdir = dir + 180: move = True 
    If KeyDown(KEY_LEFT) Then tempdir = dir + 90: move = True
    If KeyDown(KEY_RIGHT) Then tempdir = dir - 90: move = True
    
End If
    If move = True 
        move = False
        tempx = x - Cos(tempdir) * amount
        tempy = y - Sin(tempdir) * amount
        If Asc(level(Int(tempx),Int(tempy))) = 48 Then 
            If snd Then
                If Not SoundPlaying(chnlWALK) Then chnlWALK = PlaySound(sndWALK,20,0,22010+0000)
            End If
            __walk = 1000
            x = tempx : y = tempy
        Else
            If snd And SoundPlaying(chnlWALK) Then StopSound chnlWALK
        End If
    Else
        If snd And SoundPlaying(chnlWALK) Then StopSound chnlWALK
    EndIf
    
    If xtimer=-1 And EscapeKey() Then 
        Color cbRed
        TextOut( 10,84,"Exit to the menu by pressing ESC again.",COLOR_RED)
        DrawScreen 0
        key = WaitKey()
        If key=1 Then Goto ENDLEVEL 
        
        Cls
        ClearKeys
        ClearMouse
        PositionMouse SCRNWIDTHD2, SCRNHD2
    End If
    
    If Mouse_Hit And reload=0 And AMMO>0 Then
        If snd And SoundPlaying(chnlGUN) Then StopSound chnlGUN
        If snd Then chnlGUN = PlaySound(sndGUN)
        reload = 1100
        frameASE = 1
        AMMO-1
        
        patiX = 320 + Rand(-__error-15,__error+15)
        patiY = 240 + Rand(-__error-15,__error+15)
        
        BULLETSHOT = True
        
    End If
    
    
    If reload > 1000 Then
        frameASE = 1
    ElseIf reload > 1100-750 Or reload < 1100-900 Then
        frameASE = 0
    Else
        frameASE = 2
    End If
    
    reload = (reload - (reload > 0) * FT * 1000) (reload > 0)
    
    __walk = __walk - 100 (__walk > 0)
    
If xtimer = -1 Then    
    
    dir = WrapAngle(dir - (MouseMoveX()/2))
    halfh = halfh - MouseMoveY()
    If halfh > SCRNH Then halfh = SCRNH
    If halfh < 0 Then halfh = 0

End If    
    
    PositionMouse SCRNWIDTHD2, SCRNHD2
    GoSub Renderer
Forever

Renderer:

    Cls
     
    Color colors(15,0),colors(15,1),colors(15,2): Box 0,0,SCRNWIDTH,halfh
    Color colors(16,0),colors(16,1),colors(16,2): Box 0,halfh,SCRNWIDTH,SCRNH-halfh
    drawx = 0
    
    
    Select _det
        Case 1
            For ang = dir + 32 To dir - 31 Step -1
                StpX# = Cos(ang)*.1
                StpY# = Sin(ang)*.1
                XX# = x : YY# = y
                length = 0
                Repeat 
                    XX = XX - StpX
                    YY = YY - StpY
                    length = length + 1
                    char = level(Int(XX),Int(YY))
                Until char <> "0"
                drawy = 2000 / length
                
                If Not char = "0" Then 
                    Color colors(Int2(char),0),colors(Int2(char),1),colors(Int2(char),2)
                End If
                
                Box drawx, halfh - drawy, 10*_det, 2*drawy, ON
                drawx = drawx + (10 * _det)
            Next ang
        Case 2
            For ang = dir + 32 To dir - 31 Step -2 
                StpX# = Cos(ang)*.1
                StpY# = Sin(ang)*.1
                XX# = x : YY# = y
                length = 0
                Repeat 
                    XX = XX - StpX
                    YY = YY - StpY
                    length = length + 1
                    char = level(Int(XX),Int(YY))
                Until char <> "0" 
                drawy = 2000 / length
                
                If Not char = "0" Then 
                    Color colors(Int2(char),0),colors(Int2(char),1),colors(Int2(char),2)
                End If
                
                Box drawx, halfh - drawy, 10*_det, 2*drawy, ON 
                drawx = drawx + (10 * _det)
            Next ang
        Case 3
            For ang = dir + 32 To dir - 31 Step -3 
                StpX# = Cos(ang)*.1
                StpY# = Sin(ang)*.1
                XX# = x : YY# = y
                length = 0
                Repeat 
                    XX = XX - StpX
                    YY = YY - StpY
                    length = length + 1
                    char = level(Int(XX),Int(YY))
                Until char <> "0" 
                drawy = 2000 / length
                
                If Not char = "0" Then
                    Color colors(Int2(char),0),colors(Int2(char),1),colors(Int2(char),2)
                End If
                
                Box drawx, halfh - drawy, 10*_det, 2*drawy, ON
                drawx = drawx + (10 * _det)
            Next ang
    End Select
    
    Color cbblack
    
    
    count = 0

    For b.BOT = Each BOT
        count+1
        ps = PointSight(b\x,b\y,x,y)
        
        angle# = WrapAngle(GetAngle(x,y,b\x,b\y)+dir-180)
            
        dist# = Distance(b\x,b\y,x,y)
        
        If xtimer=-1 Then Gosub AI
        
        If ps Then
            
            frame = Int(31-dist*SOME_VALUE)
            If dist>31 Then frame = -1
            
            If frame>-1 Then
            
                IW = ImageWidth(zombies(frame,z_walk))
                IH = ImageHeight(zombies(frame,z_walk))
            
            End If
            
            If frame>=0 And frame <=31 Then
                zx# = 320+(WrapAngle2(angle)*10)-IW/2
         
                zy# = halfh+10
            
                DrawImage zombies(frame,z_walk),zx#,zy
            End If
    
            If BULLETSHOT Then
                BULLETSHOT = False
                zx = zx - IW / 2
                zy = zy - IH / 2
                If patiX >= zx And patiX <= zx + IW And patiY >= zy And patiy <= zy +IH Then
                
                    hitX = Int(Abs( (patiX-zx) / IW * ORIGINALZOMBIEW  ))
                    hitY = Int(Abs( (patiY-zy) / IH * ORIGINALZOMBIEH  ))
                    
                    PickImageColor imgHITAREA(z_walk),hitX,hitY
                    
                    b\hp = b\hp - hitamounts(getRGB(RED) Shr 4)
                    
                    If b\hp < 0 Then
                        be.BLOODEFFECT = New(BLOODEFFECT)
                        be\x = b\x
                        be\y = b\y
                        be\frame = 5
                        Delete b 
                        If snd Then PlaySound sndDEATH,100,0,10000
                        Goto asd0084
                    Else
                        If snd Then PlaySound sndOUCH,100,0,10000
                    End If
                    
                End If
            End If
    
        End If
        
    asd0084:
    Next b
    
    
    For pp.HPPACK = Each HPPACK
        angle# = WrapAngle(GetAngle(x,y,pp\x,pp\y)+dir-180)
        If PointSight(pp\x,pp\y,x,y) Then
                dist# = Distance(pp\x,pp\y,x,y)
                
                frame = Int(31-dist*SOME_VALUE)
                If dist>31 Then frame = -1
                
                If frame>=0 And frame <=31 Then
                    zx# = 320+(WrapAngle2(angle)*10)-ImageWidth(hppacks(frame))/2
                
                    DrawImage hppacks(frame),zx#,halfh+10
                End If
        End If  
        If Round(pp\x/2,1) = Round(x/2,1) And Round(pp\y/2,1) = Round(y/2,1) Then
            hp+25
            Delete pp
            PlaySound sndPICKUP,66,0,13000
        End If
    Next pp
    
    For bp.BULLETPACK = Each BULLETPACK
        angle# = WrapAngle(GetAngle(x,y,bp\x,bp\y)+dir-180)
        If PointSight(bp\x,bp\y,x,y) Then
                dist# = Distance(bp\x,bp\y,x,y)
                
                frame = Int(31-dist*SOME_VALUE)
                If dist>31 Then frame = -1
                
                If frame>=0 And frame <=31 Then
                    zx# = 320+(WrapAngle2(angle)*10)-ImageWidth(bulletpacks(frame))/2
                
                    DrawImage bulletpacks(frame),zx#,halfh+10
                End If

        End If
        If Round(bp\x,1) = Round(x,1) And Round(bp\y,1) = Round(y,1) Then
            ammo+8
            Delete bp
            PlaySound sndPICKUP,66,0,13000
        End If
    Next bp
    
    
    For be.BLOODEFFECT = Each BLOODEFFECT
    
        If be\frame>10 Then Delete be: Goto asd0077
        
        ps = PointSight(be\x,be\y,x,y)
        
        angle# = WrapAngle(GetAngle(x,y,be\x,be\y)+dir-180)
            
        dist# = Distance(be\x,be\y,x,y)
        
        If ps Then
        
            frame = Int(31-dist*SOME_VALUE)
            If dist>31 Then frame = -1
            
            If frame>-1 Then
                IW = ImageWidth(zombies(frame,z_walk))
            End If
            
            If frame>=0 And frame <=31 Then
                zx# = 320+(WrapAngle2(angle)*10)-IW/2
         
                zy# = halfh+10
                
                Color Int(255+127-be\frame*25.5),0,0
            
                Circle2(zx#,zy,be\frame*(IW/5/2),1)
            End If
        End If
        
        be\frame = be\frame + 1
        
        asd0077:
    
    Next be

    If hp>=0 Then DrawImage imgASE(frameASE),280+__error+24+12(frameASE=2),240+__walk/100+_error+39
    If reload > 1000 Then DrawImage imgFLAME,280+__error+19,240+__walk/100+_error-3
    
    Color cbRed
    
    If hp>=0 Then Circle 320-15-__walk/200-_error/2,240-15-__walk/200-_error/2,30+__walk/100+_error,0
    
    Color 0,0,0
    
    If APPTIMER Mod 8 = 0 Then lastfps# = Round(1.0/FT,2)
    
    TextOut( 1,1,"FPS: " + Str(lastfps#),COLOR_GREY)
  
    Color cbRed
  
    TextOut( 10,470-CHARH,"Health: "+Str(hp),COLOR_RED)
    TextOut( 630-TextWidth2("Ammo: "+Str(ammo)),470-CHARH,"Ammo: "+Str(ammo),COLOR_RED)
    
    For j = 1 To mapw
        For i = 1 To maph
            If level(i,j) = "0" Then
                Color colors(16,0),colors(16,1),colors(16,2)
                Box 10+j*5, 470-CHARH-maph*5-60+i*5,5,5
            Else
                Color cbBlack
                Box 10+j*5, 470-CHARH-maph*5-60+i*5,5,5
            End If
        Next i
    Next j
    
    For b.BOT = Each bot
        If PointSight(b\x,b\y,x,y) Then
            Color cbRed
            Box 10+Int(b\y)*5,470-CHARH-maph*5-60+Int(b\x)*5,5,5
        End If
    Next b
  
    For bp.bulletpack = Each bulletpack
        If PointSight(bp\x,bp\y,x,y) Then
            Color 0,0,255
            Box 10+Int(bp\y)*5,470-CHARH-maph*5-60+Int(bp\x)*5,5,5
        End If
    Next bp
    
    For pp.hppack = Each hppack
        If PointSight(pp\x,pp\y,x,y) Then
            Color cbWhite
            Box 10+Int(pp\y)*5,470-CHARH-maph*5-60+Int(pp\x)*5,5,5
        End If
    Next pp
    
    Color 0,255,0
    
    Box 10+Int(y)*5,470-CHARH-maph*5-60+Int(x)*5,5,5
    
    Color cbDarkYellow
  
    If xtimer>-1 Then
        If hp<0 Then
            If xtimer<1 Then
                CenterTextOut( 320,320,"Press any mouse button.",COLOR_YELLOW,2   )
                If MouseDown(1) Or MouseDown(2) Or MouseDown(3) Then Goto endlevel
            End If
            If xtimer<12000 Then
                CenterTextOut( 320,64,"You were eaten by the zombies!",COLOR_YELLOW,2)
            End If
            
            If xtimer<9000 Then
                CenterTextOut( 320,128,"You died!",COLOR_YELLOW,2     )   
            End If
            
            If xtimer<6000 Then
                CenterTextOut( 320,192,"Oh, sh#t happens. Please try again.",COLOR_YELLOW,2     )   
            End If
            
            If xtimer<3000 Then
                CenterTextOut( 320,256,"I hope you'll like this game!",COLOR_YELLOW,2    )    
            End If
        Else
            If xtimer<1 Then
                CenterTextOut( 320,320,"Press any mouse button.",COLOR_YELLOW,2  ) 
                If MouseDown(1) Or MouseDown(2) Or MouseDown(3) Then Goto endlevel
            End If
            If xtimer<12000 Then
                CenterTextOut( 320,64,"You killed all the zombies!",COLOR_YELLOW,2)
            End If
            
            If xtimer<9000 Then
                CenterTextOut( 320,128,"You won!",COLOR_YELLOW,2)        
            End If
            
            If xtimer<6000 Then
                CenterTextOut( 320,192,"Please try an other map!",COLOR_YELLOW,2)        
            End If
            
            If xtimer<3000 Then
                CenterTextOut( 320,256,"I hope you liked this game!",COLOR_YELLOW,2 )       
            End If
        End If
    End If
  
    If count=0 Or hp<0 And xtimer=-1 Then
        xtimer = 15000
        If snd Then PlaySound sndDEATH
    End If
            
    If xtimer>0 Then 
        xtimer = xtimer - FT*1300
        
        If xtimer<0 Then xtimer = 0
    End If
        
    DrawScreen 0:APPTIMER+1
Return

TransferMap:
    For j = 1 To Int(GetWord(maprow(0),2))
        For i = 1 To Int(GetWord(maprow(0),1))
            level(i,j) = Mid(maprow(j),i,1)
        Next i
    Next j
    x = Int(GetWord(maprow(0),3))
    y = Int(GetWord(maprow(0),4))
    dir = Int(GetWord(maprow(0),5))
    
    mapw = Int(GetWord(maprow(0),2))
    maph = Int(GetWord(maprow(0),1))
GoTo GAME

Function LoadTXM(filename$)
    file = OpenToRead(filename$)
        maprow(0) = ReadLine(file)
    
        ClearArray ON
    
        WAYPOINTCOUNT = 0
        ReDim WAYPOINTS(0)
        
        ClearArray OFF
        
        ptr = 1
        While Not EOF(file)
            start_loop:
        
            read_line$ = Trim(ReadLine(file))
            
            If Upper(GetWord(read_line,1)) = "REM" Or read_line = "" Then Goto start_loop
            
            If Upper(read_line) = "EVENTS" Then
                Repeat
                    loop2:
                    
                    read_line$ = Upper(Trim(ReadLine(file)))
                    
                    If read_line$ = "END EVENTS" Or read_line$ = "ENDEVENTS" Or read_line$ = "/EVENTS" Then Goto start_loop
                    
                    Select GetWord(read_line,1)
                        Case "REM"
                            Goto loop2
                        Case "ZOMBIE"
                            b.BOT = New(BOT)
                            b\x = Int(GetWord(read_line,2))
                            b\y = Int(GetWord(read_line,3))
                            b\towaypoint = Int(GetWord(read_line,4))
                            b\hp = 100
                        Case "HP"
                            pp.HPPACK = New(HPPACK)
                            pp\x = Int(GetWord(read_line,2))
                            pp\y = Int(GetWord(read_line,3))
                        Case "BULLETS"
                            bp.BULLETPACK = New(BULLETPACK)
                            bp\x = Int(GetWord(read_line,2))
                            bp\y = Int(GetWord(read_line,3))
                        Case "WAYPOINT"
                            WAYPOINTCOUNT + 1
                            ReDim WAYPOINTS(WAYPOINTCOUNT)
                            
                            wp.WAYPOINT = New(WAYPOINT)
                            wp\x = Int(GetWord(read_line,2))
                            wp\y = Int(GetWord(read_line,3))
                            
                            zxczxczxc = CountWords(read_line)
                            
                                                wp\p1 = Int(GetWord(read_line,4)) : wp\pc + 1
                            If zxczxczxc>4 Then wp\p2 = Int(GetWord(read_line,5)) : wp\pc + 1
                            If zxczxczxc>5 Then wp\p3 = Int(GetWord(read_line,6)) : wp\pc + 1
                            If zxczxczxc>6 Then wp\p4 = Int(GetWord(read_line,7)) : wp\pc + 1
                            
                            WAYPOINTS(WAYPOINTCOUNT) = ConvertToInteger(wp)
                            
                    End Select
                   
                Forever
            End If
            
            maprow(ptr) = read_line
            ptr + 1
        
        Wend
    CloseFile file
End Function 

Function SetError(canbeoverzero)
    Return Rand(__walk/100-3,__walk/100+3*canbeoverzero)
End Function

Function WrapAngle2(angle)
    v=angle
    If v<0 Then
        While v<0
            v+360
        Wend
    ElseIf v>360 Then
        While v>360
            v-360
        Wend
    End If
    If v>180 Then
        Return v-360
    Else
        Return v
    End If
End Function

Function PointSight(x1#,y1#,x2#,y2#)
    D# = Distance(x1,y1,x2,y2)
    If D<1 Then Return 1

    askel# = 1/(D*POINTSIGHT_TARKKUUS)
    
    i# = 0 
    While i<=1
        x# = x1+i*(x2-x1)
        y# = y1+i*(y2-y1)
        If Asc(level(Int(x),Int(y))) <> Asc("0") Then Return 0
        For b.BOT = Each BOT
            If Not b\x=x And b\y=y Then 
                If Round(b\x/5,1) = Round(x/5,1) And Round(b\y/5,1) = Round(y/5,1) Then Return 0
            End If
        Next b
        For bp.BULLETPACK = Each BULLETPACK
            If Not bp\x=x And bp\y=y Then 
                If Round(bp\x/5,1) = Round(x/5,1) And Round(bp\y/5,1) = Round(y/5,1) Then Return 0
            End If
        Next bp
        For pp.HPPACK = Each HPPACK
            If Not pp\x=x And pp\y=y Then 
                If Round(pp\x/5,1) = Round(x/5,1) And Round(pp\y/5,1) = Round(y/5,1) Then Return 0
            End If
        Next pp
        i=i+askel
    Wend
    
    Return 1
    
End Function

AI:
    If ps Then
        a# = WrapAngle(GetAngle(b\y,b\x,y,x)-90)
        
        If Not Round(b\x/2,1) = Round(x/2,1) And Round(b\y/2,1) = Round(y/2,1) Then
        
            tx# = b\x - Cos(a)*amount*0.85
            ty# = b\y - Sin(a)*amount*0.85
        
        End If
        
        If Asc(level(Int(tx),Int(ty))) = 48 Then
            b\x = tx
            b\y = ty
        End If
        
        If Round(b\x/2,1) = Round(x/2,1) And Round(b\y/2,1) = Round(y/2,1) Then
            If Not SoundPlaying(b\chnlGRR) Then
                HP = HP - Rand(5,15)
                b\chnlGRR = PlaySound(sndGRR,100(Not(Not snd)),Sin(angle)*100, 9500)
            End If
        End If
    Else
        wp.WAYPOINT = ConvertToType(WAYPOINTS(b\ToWayPoint))
      
        wp.waypoint = First(waypoint)
        a# = WrapAngle(GetAngle(b\y,b\x,wp\y,wp\x)-90)
       
        tx# = b\x - Cos(a)*amount*0.85
        ty# = b\y - Sin(a)*amount*0.85
        
        If Asc(level(Int(tx),Int(ty))) = 48 Then
            b\x = tx
            b\y = ty
        End If 
        
        If Round(b\x/2,1) = Round(wp\x/2,1) And Round(b\y/2,1) = Round(wp\y/2,1) Then
            
            Select wp\pc
                Case 1
                    b\towaypoint = wp\p1
                Case 2
                    val = Rand(1,2)
                    Select val
                        Case 1
                            b\towaypoint = wp\p1
                        Case 2
                            b\towaypoint = wp\p2
                    End Select
                Case 3
                    val = Rand(1,3)
                    Select val
                        Case 1
                            b\towaypoint = wp\p1
                        Case 2
                            b\towaypoint = wp\p2
                        Case 3
                            b\towaypoint = wp\p3
                    End Select
                Case 4
                    val = Rand(1,4)
                    Select val
                        Case 1
                            b\towaypoint = wp\p1
                        Case 2
                            b\towaypoint = wp\p2
                        Case 3
                            b\towaypoint = wp\p3
                        Case 4
                            b\towaypoint = wp\p4
                    End Select
                Default
                    MakeError "there's something wrong with teh map"
            End Select
            
        End If
        
    End If
Return

Function Int2(value$)
    If value$ = "0" Then Return 0
    If value$ = "1" Then Return 1
    If value$ = "2" Then Return 2
    If value$ = "3" Then Return 3
    If value$ = "4" Then Return 4
    If value$ = "5" Then Return 5
    If value$ = "6" Then Return 6
    If value$ = "7" Then Return 7
    If value$ = "8" Then Return 8
    If value$ = "9" Then Return 9
    If value$ = "A" Then Return 10
    If value$ = "B" Then Return 11
    If value$ = "C" Then Return 12
    If value$ = "D" Then Return 13
    If value$ = "E" Then Return 14
    If value$ = "F" Then Return 15
    Return 0
End Function

ENDLEVEL:

    For b.BOT = Each BOT
        Delete b
    Next b
    
    For bp.BULLETPACK = Each BULLETPACK
        Delete bp
    Next bp
    
    For pp.hpPACK = Each hpPACK
        Delete pp
    Next pp
    
    For wp.WAYPOINT = Each WAYPOINT
        Delete wp
    Next wp
    
    For be.BLOODEFFECT = Each BLOODEFFECT
        Delete be
    Next be
    
    MENUSTATE = 0
    
    Cls

Goto MENU

Function pointinbox(px,py,x,y,w,h)
    If Not px >= x Then Return 0
    If Not px <= x+w Then Return 0
    
    If Not py >= y Then Return 0
    If Not py <= y+h Then Return 0
    
    Return 1
End Function

Function Str2$(value,style=0)
    Select style
        Case 0
            If value=0 Then Return "OFF" Else Return "ON"
        Default
            If value=0 Then Return "FALSE" Else Return "TRUE"
    End Select
End Function

Function Str3$(value)
    Select value
        Case 1: Return "High"
        Case 2: Return "Medium"
        Case 3: Return "Low"
    End Select
End Function

WriteSettings:
    If FileExists("..\settings.ini") Then DeleteFile "..\settings.ini"
    sett = OpenToWrite("..\settings.ini")
        WriteLine sett,"DETAIL_LEVEL = "+Str(_det)
        WriteLine sett,"SOUNDS = "+Str(snd)
        WriteLine sett,"KEY_FWD = "+Str(KEY_FWD)
        WriteLine sett,"KEY_BACK = "+Str(KEY_BACK)
        WriteLine sett,"KEY_RIGHT = "+Str(KEY_RIGHT)
        WriteLine sett,"KEY_LEFT = "+Str(KEY_LEFT)
    CloseFile sett
Return 

Load_Font:
    
    fontd = OpenToRead("font.dat")
        FontData(256) = ReadByte(fontd)
        For i=0 To 255
            FontData(i) = ReadByte(fontd)
        Next i
    CloseFile fontd

    font = LoadImage("font.png")

Return

Function TextOut(x,y,txt$,colour)
    ptr2 = 0
    LastTextWidth = 0
    
    For i=1 To Len(txt)
        char$ = Mid(txt,i,1)
        charI = Asc(char)
        
        ptr = 0
        
        For t=0 To charI-1
            ptr = ptr + FontData(t)
        Next t

        DrawImageBox font,x+ptr2,y,ptr,colour*FontData(256),FontData(charI),FontData(256),0,1
        
        LastTextWidth = LastTextWidth + FontData(charI)
        
        ptr2 = ptr2 + FontData(charI)
    Next i
End Function

Function TextWidth2(txt$)
    tw=0
    For i=1 To Len(txt)
        tw = tw+FontData(Asc(Mid(txt,i,1)))
    Next i
    Return tw
End Function

Function TextHeight2(txt$)
    Return FontData(256)
End Function

Function CenterTextOut(x,y,txt$,clr,style=0)
    Select style
        Case 0
            x = x-TextWidth2(txt)/2
        Case 1
            y = y-TextHeight2(txt)/2
        Case 2
            x = x-TextWidth2(txt)/2
            y = y-TextHeight2(txt)/2
    End Select
    TextOut(x,y,txt$,clr)
End Function

Siirryn nyt Javaan. Heippa vaan kaikille!

User avatar
elmo123
Active Member
Posts: 153
Joined: Sun Sep 09, 2007 4:19 pm

Re: Kill teh Zombies (Beta 1.0)

Post by elmo123 » Sun Sep 28, 2008 2:47 pm

Galgoneer: latauslinkkisi ei toimi.
Kiinnostuin pelien tekemisestä ennen 1. luokkaa.
Sitten 3. luokalla tuli CB. Ja siitä se alkoi.

Blender! TF2! CB! Game Maker! Nokia-mollaus! Kitaransoitto! Breakdance! MadTracker! Minecraft!

Post Reply