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