Pikapelikisa 21 - uusinta

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

Re: Pikapelikisa 21 - uusinta

Post by Ruuttu »

Tässä on:

Code: Select all

SW = 800
SH = 600
SCREEN SW,SH

Global S As Float
S = 0.0
Global g_tmpTime As Integer
g_tmpTime = 0

// Palautetaan siirtymä (pikseliä sekunnissa)
Function PxPerSec(px#)
    Return px# * S
End Function

// Päivitetään vakionopeusajastin
Function UpdateSpeed()
    curTime = TIMER()
    If g_tmpTime = 0 Then g_tmpTime = curTime
    S = Min((curTime - g_tmpTime) / 1000.0,0.05)
    g_tmpTime = curTime
End Function

Type STUFF
    Field Obj As Integer
    Field Spd As Float
    Field Rot As Float
EndType

Type USELESSBULLSHIT
    Field X As Float
    Field Y As Float
    Field W
    Field H
    Field SPD As Float
EndType

SetWindow "Pacman Eats Junkfood"

Plr = LoadObject("Media\pacman.bmp",360)

ObjectsTotal = 7
Dim Objects(ObjectsTotal) As integer
DefaultVisible OFF
Objects(1) = LoadObject("Media\car.bmp",90)
Objects(2) = LoadObject("Media\car2.bmp",90)
Objects(3) = LoadObject("Media\bigbullet.bmp",45)
Objects(4) = LoadObject("Media\cow.bmp",90)
Objects(5) = LoadObject("Media\tatti.bmp",45)
Objects(6) = LoadObject("Media\guy.bmp",90)
Objects(7) = LoadObject("Media\fireball.bmp",45)
DefaultVisible ON

BigFont = LoadFont("tahoma",SH/8)
SmallFont = LoadFont("tahoma",SH/14)

StartGame:

ShowObject Plr,ON
ScreenPositionObject Plr,SW*0.5,SH*0.9

StuffTimer = Timer()
UselessTimer = Timer()

StuffTime = 200
Tempo# = 1900.0
MainSpeed# = 10.0
MaxPlrSpd# = SW*1.0
PlrVelocity# = 2.5
PlrAng# = 90.0

ShitLoadTimer = Timer() - 10000

ColorA# = Rand(360.0)

BRGT# = 0.2

PROGRESS# = 0.5
PROGRESS2# = 0.5

ClsColor 255-(Cos(ColorA#)*127.0+127.0)*BRGT#,255-(Cos(ColorA#+120)*127.0+127.0)*BRGT#,255-(Cos(ColorA#+240)*127.0+127.0)*BRGT#
Cls

ClearKeys

Repeat

    UpdateSpeed()

    If KeyDown(cbkeyleft) Then PlrSpd# = PlrSpd# - SW*PlrVelocity#*S : PlrAng# = PlrAng# - Min(PlrSpd#*0.1*S,-50.0*S)
    If PlrSpd# < -MaxPlrSpd# Then PlrSpd# = -MaxPlrSpd#
    If KeyDown(cbkeyright) Then PlrSpd# = PlrSpd# + SW*PlrVelocity#*S : PlrAng# = PlrAng# - Max(PlrSpd#*0.1*S,50.0*S)
    If PlrSpd# > MaxPlrSpd# Then PlrSpd# = MaxPlrSpd#
    TranslateObject Plr,PlrSpd#*S,0
    If ObjectX(Plr) < -SW/2 + ObjectSizeX(Plr)/2 Then
        PlrSpd# = -PlrSpd# * 0.9
        TranslateObject Plr,1,0
    EndIf
    If ObjectX(Plr) > SW/2 - ObjectSizeX(Plr)/2 Then
        PlrSpd# = -PlrSpd# * 0.9
        TranslateObject Plr,-1,0
    EndIf
    
    RotateObject Plr,PlrAng#
    If PlrAng# < 90 Then PlrAng# = Min(PlrAng# + 40.0*S,90)
    If PlrAng# > 90 Then PlrAng# = Max(PlrAng# - 40.0*S,90)
    
    If Timer() - StuffTimer > StuffTime Then
        StuffTime = Tempo * Rnd(0.2,1.2)
        StuffTimer = Timer()
        
        Tmp1 = 1
        
        If Rand(1,50) = 1 And Timer() - ShitLoadTimer > 20000 Then
            ShitLoadTimer = Timer()
            Tmp1 = Rand(8,12)
        EndIf
        
        For I = 1 To Tmp1
            NewStuff.STUFF = New(STUFF)
            NewStuff\obj = CloneObject(Objects(Rand(1,ObjectsTotal)))
            ScreenPositionObject NewStuff\obj,Rand(SW*0.05,SW-SW*0.05),-(SH*Rnd(0.1,0.4))
            RotateObject NewStuff\obj,Rand(360)
            NewStuff\Spd = -Rnd(SH*0.04,SH*0.06)*MainSpeed#
            NewStuff\Rot = Rand(-180,180)
            ObjectOrder Plr,1
        Next I

    
    EndIf
    
    For iStuff.STUFF = Each STUFF
        TranslateObject iStuff\obj,Cos(ObjectY(iStuff\obj))*SH*0.05*S,iStuff\Spd*S
        TurnObject iStuff\obj,iStuff\Rot*S
        If (Distance(ObjectX(iStuff\obj),0,ObjectX(Plr),0) < ObjectSizeX(Plr)/2 And Distance(ObjectY(iStuff\obj),0,ObjectY(Plr),0) < (ObjectSizeY(Plr)/2+ObjectSizeY(iStuff\obj)/2)/2) Then
            DeleteObject iStuff\obj
            Delete iStuff
            If MainSpeed# < 4.0 Then
                Tempo# = Tempo# - 10
                MainSpeed# = MainSpeed# + SH*0.00015
                MaxPlrSpd# = MaxPlrSpd# + SH*0.00001
                PlrVelocity# = PlrVelocity# + (SW*0.00001)*0.5
            EndIf
            PROGRESS# = Min(PROGRESS#+0.06,1.0)
        ElseIf ObjectY(iStuff\obj)<-SH*0.6 Then
            DeleteObject iStuff\obj
            Delete iStuff
            PROGRESS# = PROGRESS#-0.07
        EndIf
    Next iStuff
    
    Gosub StupidBullshitBackground
    
    DrawGame
    
    PROGRESS2# = CurveValue(PROGRESS#,PROGRESS2,5.0)
    Color BullshitR#*0.6,BullshitG#*0.6,BullshitB#*0.6
    Box SW/2-SW/4,SH/10,SW/2,SH/20,0
    Box SW/2-SW/4+SH/300,SH/10+SH/300,(SW/2-(SH/300)*2)*PROGRESS2#,SH/20-(SH/300)*2

DrawScreen
    If PROGRESS2# =< 0.0 Then Goto GameOver
Forever

GameOver:

    For iStuff.STUFF = Each STUFF
        DeleteObject iStuff\obj
        Delete iStuff
    Next iStuff
    
    ShowObject Plr,OFF

    ClearKeys
Repeat
    
    UpdateSpeed()
    
    Gosub StupidBullshitBackground
    
    Color BullshitR*0.5,BullshitG*0.5,BullshitB*0.5
    SetFont BigFont
    CenterText SW/2,SH/6,"GAME OVER!"
    SetFont SmallFont
    CenterText SW/2,SH/6+SH/8,"YOU IDIOT!!!"
    
    CenterText SW/2,SH-SH/5,"Press SPACE t"+"o LOSE AGAIN!"

DrawScreen
    If KeyHit(cbkeyspace) Then Goto StartGame
Forever

StupidBullshitBackground:
    ColorA# = WrapAngle(ColorA# + 10.0*S)
    ClsColor 255-(Cos(ColorA#)*127.0+127.0)*BRGT#,255-(Cos(ColorA#+120)*127.0+127.0)*BRGT#,255-(Cos(ColorA#+240)*127.0+127.0)*BRGT#
    BullshitR# = 255-(Cos(ColorA#)*127.0+127.0)*(BRGT#+0.2)
    BullshitG# = 255-(Cos(ColorA#+120)*127.0+127.0)*(BRGT#+0.2)
    BullshitB# = 255-(Cos(ColorA#+240)*127.0+127.0)*(BRGT#+0.2)

    If Timer() - UselessTimer > 400 Then
        UselessTimer = Timer()
        NewBullshit.USELESSBULLSHIT = New(USELESSBULLSHIT)
        NewBullshit\X = Rand(-50,SW)
        NewBullshit\Y = Rand(-50,-100)
        NewBullshit\W = Rand(SH*0.05,SH*0.1)
        NewBullshit\H = Rand(SH*0.05,SH*0.1)
        NewBullshit\SPD = Rnd(SH*0.1,SH*0.2)
    EndIf
    
    For iBullshit.USELESSBULLSHIT = Each USELESSBULLSHIT
        Color BullshitR,BullshitG,BullshitB
        Box iBullshit\X,iBullshit\Y,iBullshit\W,iBullshit\H
        iBullshit\Y = iBullshit\Y + iBullshit\SPD*S
        If iBullshit\Y > SH Then Delete iBullshit
    
    Next iBullshit
Return
Pacman syö roskaruokaa
Last edited by Ruuttu on Fri Oct 16, 2009 8:58 pm, edited 3 times in total.
Nassi_Setä
Advanced Member
Posts: 281
Joined: Sat Jun 28, 2008 5:19 pm
Location: Hämeessä miä

Re: Pikapelikisa 21 - uusinta

Post by Nassi_Setä »

tiukalle meni, peli on tässä
Pelissä pitää väistellä tatteja.
EDIT:

ei kökkö myöhästyin minuutilla :evil:

Attachments
ppk.rar
(587.57 KiB) Downloaded 202 times
\../(-_-)\../ <---klick MyBrute Image
Jotain evilii on tekeillä....
RFA (v*tun netti ku ei toimi)

Re: Pikapelikisa 21 - uusinta

Post by RFA (v*tun netti ku ei toimi) »

Code: Select all

SCREEN 800,600
Type tank
    Field obj
    Field class
    Field tobj
    Field speed As Float
    Field top_speed
    Field hp
    Field cd
    Field cdb
EndType
Type soldier
    Field obj
    Field hp
    Field cd
    Field cdb
EndType
Type pake
    Field obj
    Field ohjus
    Field life
    Field side
    Field savu
EndType
ChDir "media"
cross=LoadImage("crosshair.bmp")
ShowMouse cross
ruohikko=LoadImage("grass.bmp")
maa=MakeObjectFloor()
PaintObject maa,ruohikko
DefaultVisible OFF
tank_a=LoadObject("car.bmp",70)
tank_b=LoadObject("car2.bmp",70)
tank_at=LoadObject("cannon.bmp",70)
vihu=LoadObject("guy.bmp",70)
pakeo=LoadObject("bullet.bmp",70)
DefaultVisible ON
pl=LoadObject("soldier.bmp",70)
DrawToWorld ON,ON,ON
Repeat
Gosub timeri
Gosub ukon_komennot
Gosub AI
CloneCameraPosition pl

DrawScreen
Until EscapeKey()
End

timeri:
If vihut=0 Then
    dioq=Rand(3,6)
    For x=1 To dioq
        vihut+1
        diot=Rand(1,3)
        Select diot
            Case 1
                nt.tank=New(tank)
                nt\class=1
                nt\tobj=CloneObject(tank_at)
                nt\obj=CloneObject(tank_a)
                nt\top_speed=3
                nt\hp=200
                nt\cd=1350
                PositionObject nt\obj,ObjectX(pl)+Rand(-2000,2000),ObjectY(pl)+Rand(-2000,2000)
            Case 2
                nt.tank=New(tank)
                nt\class=2
                nt\obj=CloneObject(tank_b)
                nt\top_speed=Rand(4,6)
                nt\hp=100
                nt\cd=5500
                PositionObject nt\obj,ObjectX(pl)+Rand(-2000,2000),ObjectY(pl)+Rand(-2000,2000)
            Case 3
                ns.soldier=New(soldier)
                ns\obj=CloneObject(vihu)
                ns\hp=50
                PositionObject ns\obj,ObjectX(pl)+Rand(-2000,2000),ObjectY(pl)+Rand(-2000,2000)
        EndSelect
    Next x
EndIf
Return

ukon_komennot:
RotateObject pl,-GetAngle(ObjectX(pl),ObjectY(pl),MouseWX(),MouseWY())
If MouseDown(2) Then MoveObject pl,1
If MouseDown(1) Then
    If Timer()>plcd+750 Then
        Gosub newpake
        plcd=Timer()
        PlaySound "Gun 1.wav"
    EndIf
EndIf
Return

newpake:
np.pake=New(pake)
np\obj=CloneObject(pakeo)
np\ohjus=0
np\life=3500
np\side=0
CloneObjectPosition np\obj,pl
CloneObjectOrientation np\obj,pl
MoveObject np\obj,34
Return

AI:
For t.tank=Each tank
    RotateObject t\obj,CurveValue(GetAngle2(t\obj,pl),ObjectAngle(t\obj),60)
    If t\class=1 Then 
        RotateObject t\tobj,CurveValue(GetAngle2(t\tobj,pl),ObjectAngle(t\tobj),30)
        CloneObjectPosition t\tobj,t\obj
    EndIf
    If Distance2(t\obj,pl)<1000 And t\class=1 Then
        If Timer()>t\cdb+t\cd
            For x=1 To 6
                np.pake=New(pake)
                np\obj=CloneObject(pakeo)
                np\ohjus=0
                np\life=3500
                np\side=1
                CloneObjectPosition np\obj,t\tobj
                CloneObjectOrientation np\obj,t\tobj
                MoveObject np\obj,34,Rand(-2,2)
                TurnObject np\obj,Rand(-2,2)
            Next x
            PlaySound "Cannon.wav"
            t\cdb=Timer()
        EndIf
        If t\speed>0 Then t\speed-0.1
    Else 
        If t\speed<t\top_speed Then
            t\speed+0.2
        Else
            t\speed=t\top_speed
        EndIf
    EndIf
Next t
For s.soldier=Each soldier
    If Distance2(s\obj,pl)<500 Then
        RotateObject s\obj,CurveValue(GetAngle2(s\obj,pl),ObjectAngle(s\obj),20)
        If Timer()>s\cdb+s\cd
            np.pake=New(pake)
            np\obj=CloneObject(pakeo)
            np\ohjus=0
            np\life=3500
            np\side=1
            CloneObjectPosition np\obj,s\obj
            CloneObjectOrientation np\obj,s\obj
            MoveObject np\obj,-12
            np.pake=New(pake)
            np\obj=CloneObject(pakeo)
            np\ohjus=0
            np\life=3500
            np\side=1
            CloneObjectPosition np\obj,s\obj
            CloneObjectOrientation np\obj,s\obj
            MoveObject np\obj,12
            PlaySound "Gun 1.wav"
            s\cdb=Timer()
        EndIf
    Else
        MoveObject s\obj,1
        RotateObject s\obj,CurveValue(GetAngle2(s\obj,pl),ObjectAngle(s\obj),20)
    EndIf
Next s
Return

pake_ai:
For p.pake=Each pake
MoveObject p\obj,10
If p\side=0 Then
    For t.tank=Each tank
        If Distance2(p\obj,t\obj)<40 Then
            DeleteObject t\obj
            If t\class=1 Then DeleteObject t\tobj
            Delete t
            vihut-1
            Exit
        EndIf
    Next t
    For s.soldier=Each soldier
        If Distance2(p\obj,s\obj)<30 Then
            DeleteObject s\obj
            Delete s
            vihut-1
            Exit
        EndIf
    Next s
Else
    If Distance2(p\obj,pl)<20 Then End
EndIf
Next p
Return
Tuxu
Member
Posts: 81
Joined: Tue Oct 14, 2008 5:54 pm
Location: Jyväskylä
Contact:

Re: Pikapelikisa 21 - uusinta

Post by Tuxu »

Ei niin minuutin päälle. Mutta nyt ei enää töitä oteta vastaan!

Äänestyksen laitan, kunhan olen tarkastanut kaikki pelit.
aivot pohtii ja raksuttaa
TuxuGames | Projektiblogi
Lazyanttu
Newcomer
Posts: 29
Joined: Sat May 16, 2009 10:18 pm

Re: Pikapelikisa 21 - uusinta

Post by Lazyanttu »

Ääh... olin matikan kokeessa joten en voinut oikein koodata :/. Pahoittelen
Requiem for Anthrax
Active Member
Posts: 155
Joined: Wed Dec 03, 2008 8:17 pm
Location: Haukipudas

Re: Pikapelikisa 21 - uusinta

Post by Requiem for Anthrax »

ähhh... tyhmät dna työntekiät. katkoo luvatta yhteyksiä, samalla pelistäni puutuu yksi aika tärkeä rivi :D ei luodi lennä :D
Turmankylä
huonoja pelejä, purkkaisia viritelmiä, tylsiä tarinoita.
Post Reply