I am gonna drop the drifting thing, so don't expect it soon. I might do it when I am done with everything else
Code: Select all
SCREEN 600,450
x#=200
y#=200
direction#=270
acceleration#=0
maxspeed#=3.0
gear#=1
turboleft#=1
turbomax#=1
damage#=100
breakdown#=0
Repeat
Cls
Color 255, 255, 255
Box 0,0,599,339,0
If x>=586 Then damage = damage - 1
If x<=10 Then damage = damage - 1
If y<=10 Then damage = damage - 1
If y>=328 Then damage = damage - 1
If x>=586 Then
x=584
acceleration = 0
EndIf
If x<=10 Then
x=13
acceleration = 0
EndIf
If y<=10 Then
y=13
acceleration = 0
EndIf
If y>=328 Then
y=325
acceleration = 0
EndIf
maxspeed = (gear*.22)+.40
speedx#=Cos(direction)
speedy#=Sin(direction)
x=x+(speedx*acceleration)
y=y+(speedy*acceleration)
If damage <=0 Then
breakdown = True
damage = 0
EndIf
If damage >= 100.01 Then
damage = 100
breakdown = False
x = 200
y = 200
gear = 1
direction = 270
turboleft = 1
EndIf
If damage <= 75 And breakdown = False Then
Text 140, 126, "Your turbo containers have sprung a leak!"
Text 100, 138, "You will loose air based oh how much more damage you get!"
If turboleft >= 0 Then
turboleft = turboleft - (.00001 * (100 - (damage + 25)))
If turboleft <=0 Then turboleft = 0
Goto breakdown
EndIf
EndIf
breakdown:
If breakdown = True Then
While breakdown = True
acceleration = 0
Text 100,150, "Your car has broken down! Hold SpaceBar to repair it!"
If (KeyDown(57)) Then
Text 200,162, "Fixing car!"
redc = 0
greenc = 0
bluec = 255
fixing = True
While fixing = True
damage = damage + 0.1
Goto draw
Wend
EndIf
Goto draw
Wend
EndIf
If (KeyDown(200)) Then
//Accelerating
If (acceleration<maxspeed) Then acceleration=(acceleration+0.003(gear))+(0.7-acceleration)/1000
Else
acceleration=acceleration*0.99 'Reducing speed when not accelerating
EndIf
If (KeyDown(208)) And acceleration > 0 Then
//Braking
If acceleration>-10 Then acceleration=acceleration-0.008
EndIf
If (KeyDown(205)) Then
//Turn right
If acceleration > 0 Then
If direction + 3>360 Then direction = 3 Else direction = direction + (acceleration*2)
Endif
EndIf
If (KeyDown(203)) Then
//Turn left
If acceleration > 0 Then
If direction - 3<0 Then direction = 357 Else direction = direction - (acceleration*2)
EndIf
EndIf
If (KeyDown(19)) And acceleration >= -0.5 Then
//reverse
acceleration = acceleration - 0.01
reverse = True
EndIf
If (KeyDown(2)) Then
//Gear 1
gear = 1
EndIf
If (KeyDown(3)) Then
//Gear 2
If acceleration > .5 Then gear = 2
EndIf
If (KeyDown(4)) Then
//Gear 3
If acceleration > .79 Then gear = 3
EndIf
If (KeyDown(5)) Then
//Gear 4
If acceleration > .99 Then gear = 4
EndIf
If (KeyDown(6)) Then
//Gear 5
If acceleration > 1.2 Then gear = 5
EndIf
If (KeyDown(42)) Then
//Turbo
If turboleft>.001 Then
maxspeed = maxspeed + .35
turboleft=turboleft-.0008
acceleration = (acceleration+0.01)+(0.7-acceleration)/1000
ElseIf turboleft=0
acceleration = acceleration
EndIf
EndIf
If acceleration>maxspeed Then acceleration=maxspeed
If turboleft<=0 Then turboleft=0
Draw:
//Draw the speedometer
speedometerx=61 'Speedometers X-center
speedometery=395 'Speedometers Y-center
Color 46,52,80 'Speedometers background color
Circle 10, 344, 102 'Speedometers background
Color 160,160,160 'Color for all the other things
Circle 10, 344, 102, ontto 'Speedometers border
Circle 57, 390, 10 'Speedometers circle in center
Line speedometerx, speedometery, speedometerx+Cos(120+Abs(acceleration*100))*40, speedometery+Sin(120+Abs(acceleration)*100)*40 'Speedometers needle
Line speedometerx+Cos(120)*45, speedometery+Sin(120)*45, speedometerx+Cos(120)*50, speedometery+Sin(120)*50 '0 km/h line
Line speedometerx+Cos(120+maxspeed*100)*45, speedometery+Sin(120+maxspeed*100)*45, speedometerx+Cos(120+maxspeed*100)*50, speedometery+Sin(120+maxspeed*100)*50 'Max-speed line
Text 70,412, ""+RoundDown( Abs(acceleration*100)) 'Show speed by using numbers
//Draw the Turbo Bar
turbox=500
turboy=400
Color 46,52,80
Circle 460,360, 80
Color 160,160,160
Circle 460,360,80, ontto
Circle 496, 396, 10
Line turbox, turboy, turbox+Cos(120+(turboleft*100))*27, turboy+Sin(120+turboleft*100)*27
Text 506,405, ""+RoundDown(turboleft*100)
Line turbox+Cos(120)*30, turboy+Sin(120)*30, turbox+Cos(120)*38, turboy+Sin(120)*38
Line turbox+Cos(120+turbomax*100)*35, turboy+Sin(120+turbomax*100)*35, turbox+Cos(120+turbomax*100)*40, turboy+Sin(120+turbomax*100)*40
//Draw the Gear number
Text 0,0, "Gear"
If reverse = True Then
Text 0,12, "Reverse"
Else
Text 0,12, gear
EndIf
//Draw the Damage Bar
Box 240, 380, 100, 30, 0
If damage >= 75 And fixing = False Then
redc = 0
greenc = 255
bluec = 0
EndIf
If damage >=25 And damage <75 And fixing = False Then
redc = 255
greenc = 255
bluec = 0
EndIf
If damage <25 And fixing = False Then
redc = 255
greenc = 0
bluec = 0
EndIf
Color redc, greenc, bluec
Box 240, 380, damage, 30
Color 255, 255, 255
Text 275, 360, Int(damage)+"%"
//Draw the "car"
angled_car ( x, y, (direction+90), 10, 10 )
Function angled_car(x,y,direction,width#,height#)
bot_l_x = x+(-(width/1)) * Cos(direction) - (height/1) * Sin(direction)
bot_l_y = y+(-(width/1)) * Sin(direction) + (height/1) * Cos(direction)
top_l_x = x+(-(width/1)) * Cos(direction) - (-(height/1)) * Sin(direction)
top_l_y = y+(-(width/1)) * Sin(direction) + (-(height/1)) * Cos(direction)
bot_r_x = x+(width/3) * Cos(direction) - (height/1) * Sin(direction)
bot_r_y = y+(width/3) * Sin(direction) + (height/1) * Cos(direction)
top_r_x = x+(width/3) * Cos(direction) - (-(height/1)) * Sin(direction)
top_r_y = y+(width/3) * Sin(direction) + (-(height/1)) * Cos(direction)
Line bot_r_x, bot_r_y, top_r_x, top_r_y
Line top_r_x, top_r_y, top_l_x, top_l_y
Line top_l_x, top_l_y, bot_l_x, bot_l_y
Line bot_l_x, bot_l_y, bot_r_x, bot_r_y
End Function
DrawScreen
Forever