Tein tämmösen kun olin mummolassa eikä ollu mitään tekemistä. Mietin että "teenpä pelin, jossa ei käytetä kuin piirtokomentoja!" ja täs se nyt on.
Code: Select all
SCREEN 800,600,0,0
SAFEEXIT OFF
menu:
Cls
selected=1
Repeat
SetFont LoadFont("impact",70)
CenterText 400,50,"THE BATTLE OF BALLS!"
SetFont LoadFont("coolb")
CenterText 375,350,"Start game"
CenterText 425,400,"Exit game"
Color cbGreen
If selected=1 Then
Box 327,346,100,20,OFF
ElseIf selected=2 Then
Box 377,398,100,20,OFF
EndIf
If KeyHit(208) Then selected +1
If KeyHit(200) Then selected -1
If selected > 2 Then selected = 2
If selected < 1 Then selected = 1
If selected=1 And KeyHit(cbKeyReturn) Then Goto game
If selected=2 And KeyHit(cbKeyReturn) Then End
DrawScreen
Forever
game:
Cls
p1_x=200
p1_y=50
p2_x=600
p2_y=50
p1_life=100
p2_life=100
p1_heart=MakeObject()
p2_heart=MakeObject()
ClsColor cbBlack
FrameLimit 50
Repeat
oldgamma=gamma
DrawGame
PositionObject p1_heart,p1_x +10,p1_y +10
PositionObject p2_heart,p2_x +10,p2_y +10
'Lattia
Color cbWhite
Line -300,505,800,505
'-------------------------------------------------------------------
'Player 1
Color cbBlue
Circle p1_x,p1_y,20,OFF
Text 10,10,"P1 energy - "+p1_life
Box 10,25,p1_life,10,OFF
If p1_reload > 0 Then Text 10,40,"RELOADING BOMBER..."
'P1 - hyppiminen
If UpKey() And p1_jump=1 Then
p1_yPlus#=4.5
p1_jump=0
EndIf
p1_y - p1_yPlus#
p1_yPlus# - 0.05
If p1_maassa=1 Then p1_yPlus# = 0
If p1_y > 500 Then
p1_maassa=1
p1_y = 500
Else
p1_maassa=0
EndIf
If p1_maassa=1 Then p1_jump=1
'P1 - liikkuminen
If RightKey() Then
p1_x +1
ElseIf LeftKey() Then
p1_x -1
EndIf
'P1 - shield
Color cbWhite
If KeyHit(82) And p1_reload=0 Then
Circle p1_x -65,p1_y -65,150,OFF
gamma=150
p1_reload=200
EndIf
If p1_reload > 0 Then p1_reload -1
If p1_reload=200 And Distance(p1_x +10,p1_y +10,p2_x +10,p2_y +10) < 150 Then p2_life -25
If p1_reload > 198 And Distance2(p2_heart,p1_heart) < 85 Then p2_life -25
'------------------------------------------------------------------------
'Player 2
Color cbRed
Circle p2_x,p2_y,20,OFF
Text 660,10,p2_life+" - P2 energy"
Box 680,25,p2_life,10,OFF
If p2_reload > 0 Then Text 640,40,"RELOADING BOMBER..."
'P2 - hyppiminen
If KeyDown(cbKeyW) And p2_jump=1 Then
p2_yPlus#=4.5
p2_jump=0
EndIf
p2_y - p2_yPlus#
p2_yPlus# - 0.05
If p2_maassa=1 Then p2_yPlus# = 0
If p2_y > 500 Then
p2_maassa=1
p2_y = 500
Else
p2_maassa=0
EndIf
If p2_maassa=1 Then p2_jump=1
'P2 - liikkuminen
If KeyDown(cbKeyD) Then
p2_x +1
ElseIf KeyDown(cbKeyA) Then
p2_x -1
EndIf
'P2 - ampuminen
Color cbWhite
If KeyHit(cbKeyE) And p2_reload=0 Then
Circle p2_x -65,p2_y -65,150,OFF
gamma = 150
p2_reload=200
EndIf
If p2_reload > 0 Then p2_reload -1
If p2_reload > 198 And Distance2(p2_heart,p1_heart) < 85 Then p1_life -25
'Muut
If gamma > 0 Then gamma -5
If oldgamma<>gamma Then ScreenGamma gamma,gamma,gamma
If p1_life=0 Then
ClearKeys
Cls
CenterText 400,200,"Player 2 wins!!!!"
CenterText 400,560,"Press ESC to continue"
If KeyHit(cbKey) Then Goto menu
ElseIf p2_life=0 Then
ClearKeys
Cls
CenterText 400,200,"Player 1 wins!!!!"
CenterText 400,560,"Press ESC to continue"
If KeyHit(cbKey) Then Goto menu
EndIf
If EscapeKey() Then Goto menu
DrawScreen
Forever