The Platform?
This is an FPS game where you must stay on your platform(Circle) and fight off all objects which try and knock you off! The game started off as being a more realistic FPS where I would try and push the boundaries of 200KB but I soon realized that textures take up quite a bit of space, even when 64x64, so I decided to make more abstract FPS game. This game took 2 days to make.
Controls?
WASD -
Move around
Left click -
Fire a single bullet(Polygon)
Right click -
Fire two(Less accuracy / Range)
Space -
Jump(rather useless)
Screenshots?
Uncompressed code:
`----------------------------------------------------
`------------------- The Platform -------------------
`----------- By Carlos(Darkcoder)Wilkes ------------
`----------------------------------------------------
` Set Screen Res ------------------------------------
Load DLL "user32.dll",1
DisplayX = Call DLL( 1 , "GetSystemMetrics" , 0 )
DisplayY = Call DLL( 1 , "GetSystemMetrics" , 1 )
`Delete DLL 1
Set Display Mode DisplayX , DisplayY , 32 , 1
`----------------------------------------------------
` Init Code -----------------------------------------
Sync On
AutoCam Off
Hide Mouse
Set Text Size 40
Ink 0,0
`----------------------------------------------------
` Globals -------------------------------------------
Global BulletCount , EntityCount
Global PolyCount As Integer = 50
`----------------------------------------------------
` Make skybox ---------------------------------------
Load Object "Data/Maps/Skysphere.x" , 10
Set Object Light 10 , 0
`----------------------------------------------------
` Make Arrays ---------------------------------------
Dim Bullet(0) As BulletType
Dim Entity(0) As EntityType
Dim Enemy(20,5) As Float
`----------------------------------------------------
` Open spawn list file ------------------------------
Open To Read 1 , "Data/Spawn.dat"
Open To Read 2 , "Data/Enemies.dat"
`----------------------------------------------------
` Load Bullets and entities -------------------------
For I = 1 To 2
Load Object "Data/Weapons/Bullet" + Str$(I) + ".X" , 90 + I
Hide Object 90 + I
Set Object Transparency 90 + I , 2
Next I
For I = 1 To 6
Load Object "Data/Weapons/Entity" + Str$(I) + ".X" , 50 + I
Hide Object 50 + I
Set Object Transparency 50 + I , 2
For X = 1 To 4
Enemy(I,X) = Val(ReadStr(2))
Next X
Next I
`----------------------------------------------------
` Load Gun and sounds -------------------------------
Load Object "Data/Weapons/Pistol/Pistol.x" , 1
Load Sound "Data/Weapons/Pistol/Fire.wav" , 1
Disable Object ZDepth 1
Load Object "Data/Weapons/Muzzle.x" , 3
Set Object Transparency 3 , 2
Disable Object ZDepth 3
ColourObject( 3 , RGB(255,255,100) )
`----------------------------------------------------
` Load Map ------------------------------------------
Load Object "Data/Maps/Map1.x" , 2
Set Object Transparency 2 , 2
Sc_SetupComplexObject 2 , 0 , 2
`----------------------------------------------------
` Init Variables ------------------------------------
OldTime = Timer()
`----------------------------------------------------
` ########################################################################################
` ########################################################################################
` ########################################################################################
Do
` HUD info ------------------------------------------
Center Text Screen Width() * 0.5 , 10, "Score: " + Str$( Score , 0 )
Text 40 , Screen Height() - 60, "Ammo: " + Str$( PolyCount )
Center Text Screen Width() * 0.5 , 200 - CurrentTime# * CurrentTime# * 10 , "Don't fall off the platform!"
`----------------------------------------------------
` Timer Based Movement ------------------------------
Elapsed# = ( Timer() - OldTime ) * 0.001
OldTime = Timer()
`----------------------------------------------------
` Camera Rotation -----------------------------------
CameraAX# = CameraAX# + (MouseMoveY()*1.0)*0.4
CameraAY# = CameraAY# + (MouseMoveX()*1.0)*0.4
If CameraAX# > 80.0
CameraAX# = 80.0
Endif
If CameraAX# < -80.0
CameraAX# = -80.0
Endif
Rotate Camera CurveValue ( CameraAX# , Camera Angle X() , 1.0 / Elapsed# * 0.1 ) , CurveValue ( CameraAY# , Camera Angle Y() , 1.0 / Elapsed# * 0.1 ) , Camera Angle Z()
`----------------------------------------------------
` Gun animation -------------------------------------
FireWait# = FireWait# - Elapsed#
Set Object Frame 1 ,Sin (Frame#)
Frame# = Frame# + Elapsed# * 1500
If Frame# > 180.0
Frame# = 180.0
Set Object Frame 1 , PolyCount = 0
Endif
`----------------------------------------------------
` Gun Shooting --------------------------------------
Scale Object 3 ,(MouseClick() > 0 And MouseClick() <= 2 And PolyCount >= MouseClick() And OldMouse = 0)*100 , 100 , 100
If MouseClick() > 0 And MouseClick() <= 2 And PolyCount >= MouseClick() And OldMouse = 0
CamDevX# = CamDevX# - 5.0
PolyCount = PolyCount - MouseClick()
Play Sound 1
Frame# = FireBullet( Limb Position X( 1 , 5 ) , Limb Position Y( 1 , 5 ) , Limb Position Z( 1 , 5 ) , 1 , MouseClick() )
Endif
OldMouse = MouseClick()
`----------------------------------------------------
` FPS Controls --------------------------------------
PlayerXVel# = CurveValue ( KeyState (32) - KeyState (30) , PlayerXVel# , 1.0 / Elapsed# * 0.4 )
PlayerZVel# = CurveValue ( KeyState (17) - KeyState (31) , PlayerZVel# , 1.0 / Elapsed# * 0.4 )
If (Abs ( PlayerXVel# ) + Abs ( PlayerZVel# )) >= 1.0
Ratio# = 1.0 / (Abs ( PlayerXVel# ) + Abs ( PlayerZVel# ))
PlayerXVel# = PlayerXVel# * Ratio#
PlayerZVel# = PlayerZVel# * Ratio#
Endif
PlayerX# = PlayerX# + Sin ( Camera Angle Y() + AtanFull(PlayerXVel#,PlayerZVel#) ) * (Abs ( PlayerXVel# ) + Abs ( PlayerZVel# )) * Elapsed# * 8.0
PlayerY# = PlayerY# + PlayerYVel# * Elapsed#
PlayerZ# = PlayerZ# + Cos ( Camera Angle Y() + AtanFull(PlayerXVel#,PlayerZVel#) ) * (Abs ( PlayerXVel# ) + Abs ( PlayerZVel# )) * Elapsed# * 8.0
`----------------------------------------------------
` Camera Collisions ---------------------------------
If Sc_SphereSlide( 0 , OldPX# , OldPY# - 1.3 , OldPZ# , PlayerX# + 0.001 , PlayerY# - 1.3 , PlayerZ# , 0.5 , 0 )
PlayerX# = Sc_GetCollisionSlideX()
PlayerY# = Sc_GetCollisionSlideY() + 1.3
PlayerZ# = Sc_GetCollisionSlideZ()
Endif
If Sc_RayCast( 2 , OldPX# , OldPY# , OldPZ# , PlayerX# , PlayerY# - 1.85 , PlayerZ# , 0)
PlayerYVel# = SpaceKey() * 4.0
PlayerY# = Sc_GetStaticCollisionY() + 1.8
Else
PlayerYVel# = PlayerYVel# - 9.8 * Elapsed#
Endif
`----------------------------------------------------
` Grab Old Camera positions -------------------------
OldPX# = PlayerX#
OldPY# = PlayerY#
OldPZ# = PlayerZ#
`----------------------------------------------------
` Orient Camera ------------------------------------
Position Camera PlayerX# , PlayerY# , PlayerZ#
CamDevX# = CurveValue( 0.0 , CamDevX# , 1.0 / Elapsed# * 0.1 )
` Orient Weapon -------------------------------------
Position Object 1 , Camera Position X() , Camera Position Y() , Camera Position Z()
Position Object 3 , Camera Position X() , Camera Position Y() , Camera Position Z()
Position Object 10 , Camera Position X() , Camera Position Y() , Camera Position Z()
Rotate Object 1 , Camera Angle X() + ( Camera Angle X() - CameraAX# ) * 0.5 + CamDevX# , Camera Angle Y() + ( Camera Angle Y() - CameraAY# ) * 0.5 + CamDevY# , Camera Angle Z()
Rotate Object 3 , Camera Angle X() + ( Camera Angle X() - CameraAX# ) * 0.5 + CamDevX# , Camera Angle Y() + ( Camera Angle Y() - CameraAY# ) * 0.5 + CamDevY# , Camera Angle Z()
Rotate Limb 3 , 1 , 0 , Timer() , 0
Rotate Limb 3 , 2 , 0 , Timer() , 0
`----------------------------------------------------
` Handle Spawning enemies ---------------------------
CurrentTime# = CurrentTime# + Elapsed#
If NOT NextTime
NextTime = Val(ReadStr( 1 ))
NextSpawn = Val(ReadStr( 1 ))
Else
If NextTime < CurrentTime#
NextTime = AddEntity( Sin(Timer()) * 100.0 , 20.0 , Cos(Timer()) * 100.0 , NextSpawn )
Endif
Endif
`----------------------------------------------------
ColourObject( 2 , Rgb( Abs(Sin(CurrentTime#*10)) * 255 , Abs(Cos(CurrentTime#*10)) * 255 , Abs(Cos(CurrentTime#*10+90)) * 255 ) )
` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
For UB = 1 To BulletCount
If Bullet(UB).Life > 0
OldX# = Bullet(UB).X
OldY# = Bullet(UB).Y
OldZ# = Bullet(UB).Z
Bullet(UB).X = Bullet(UB).X + ( Bullet(UB).XVel + Bullet(UB).EXVel ) * Elapsed#
Bullet(UB).Y = Bullet(UB).Y + ( Bullet(UB).YVel + Bullet(UB).EYVel ) * Elapsed#
Bullet(UB).Z = Bullet(UB).Z + ( Bullet(UB).ZVel + Bullet(UB).EZVel ) * Elapsed#
Position Object UB + 1000 , Bullet(UB).X , Bullet(UB).Y , Bullet(UB).Z
Point Object UB + 1000 , Camera Position X() , Camera Position Y() , Camera Position Z()
Bullet(UB).X = Object Position X (UB + 1000)
Bullet(UB).Y = Object Position Y (UB + 1000)
Bullet(UB).Z = Object Position Z (UB + 1000)
If Bullet(UB).Type_ = 1
Roll Object Right UB + 1000 , Bullet(UB).Life * 180.0
Bullet(UB).EXVel = Bullet(UB).EXVel * 1.01
Bullet(UB).EYVel = Bullet(UB).EYVel * 1.01
Bullet(UB).EZVel = Bullet(UB).EZVel * 1.01
If Sc_RayCast( 0 , OldX#-(Bullet(UB).X-OldX#)*10.0 , OldY#-(Bullet(UB).Y-OldY#)*10.0 , OldZ#-(Bullet(UB).Z-OldZ#)*10.0 , Bullet(UB).X, Bullet(UB).Y, Bullet(UB).Z , 0 )
Bullet(UB).X = Sc_GetStaticCollisionX()
Bullet(UB).Y = Sc_GetStaticCollisionY()
Bullet(UB).Z = Sc_GetStaticCollisionZ()
Speed# = Dist3D( 0.0 , 0.0 , 0.0 , Bullet(UB).XVel + Bullet(UB).EXVel , Bullet(UB).YVel + Bullet(UB).EYVel , Bullet(UB).ZVel + Bullet(UB).EZVel )
Bullet(UB).XVel = Sc_GetCollisionBounceX() * Speed# * 0.5
Bullet(UB).YVel = Sc_GetCollisionBounceY() * Speed# * 0.5
Bullet(UB).ZVel = Sc_GetCollisionBounceZ() * Speed# * 0.5
Bullet(UB).EXVel = Sc_GetCollisionBounceX() * Speed# * 0.5
Bullet(UB).EYVel = Sc_GetCollisionBounceY() * Speed# * 0.5
Bullet(UB).EZVel = Sc_GetCollisionBounceZ() * Speed# * 0.5
Position Object UB + 1000 , Bullet(UB).X , Bullet(UB).Y , Bullet(UB).Z
For I = 1 To Rnd(15) + 5
FireBullet( Bullet(UB).X , Bullet(UB).Y , Bullet(UB).Z , 2 , 1 )
Next I
If Sc_GetObjectHit() >= 100 And Sc_GetObjectHit() <= 100 + EntityCount And Bullet(UB).Type_ = 1
EntID = Sc_GetObjectHit() - 100
Hits = Hits + 1
If Entity(EntID).Life > 0
If Entity(EntID).Type_ > 1
Entity(EntID).Health = Entity(EntID).Health - 1
Entity(EntID).Breaks = -0.5
If Entity(EntID).Health = 0
Score = CurrentTime# * Hits
Rand = Rnd(Entity(EntID).Tris) + 2
For I = 1 To Rand
AddEntity( Entity(EntID).X , Entity(EntID).Y , Entity(EntID).Z , 1 )
Next I
Endif
Bullet(UB).Life = ColourObject( Sc_GetObjectHit() , RGB( 255 - Entity(EntID).Health * (255/Enemy(Int(Entity(EntID).Type_),1)) , 0 , 0 ) )
Endif
Endif
Endif
Endif
Else
Roll Object Right UB + 1000 , Bullet(UB).Life * 360.0
Endif
Bullet(UB).Life = Bullet(UB).Life - Elapsed#
If Bullet(UB).Life < 1.0
Set Alpha Mapping On UB + 1000 , Bullet(UB).Life * 100.0
Endif
If Bullet(UB).Life <= 0
Delete Object UB + 1000
Bullet(UB).EXVel = 0.0
Bullet(UB).EYVel = 0.0
Bullet(UB).EZVel = 0.0
Endif
Endif
Next UB
` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
For UE = 1 To EntityCount
If Entity(UE).Life > 0 Or Object Exist(UE + 100)
OldX# = Entity(UE).X
OldY# = Entity(UE).Y
OldZ# = Entity(UE).Z
Speed# = Dist3D( 0.0 , 0.0 , 0.0 , Entity(UE).XVel , Entity(UE).YVel , Entity(UE).ZVel )
Entity(UE).X = Entity(UE).X + Entity(UE).XVel * Elapsed#
Entity(UE).Y = Entity(UE).Y + Entity(UE).YVel * Elapsed#
Entity(UE).Z = Entity(UE).Z + Entity(UE).ZVel * Elapsed#
Position Object UE + 100 , Entity(UE).X , Entity(UE).Y , Entity(UE).Z
Point Object UE + 100 , Camera Position X() , Camera Position Y() , Camera Position Z()
Entity(UE).X = Object Position X (UE + 100)
Entity(UE).Y = Object Position Y (UE + 100)
Entity(UE).Z = Object Position Z (UE + 100)
If Entity(UE).Y < -110.0
Entity(UE).Life = -1.0
Endif
If Entity(UE).Type_ > 3
Rotate Object UE + 100 , Sin( Entity(UE).Life * 90 ) * 180 , Cos( Entity(UE).Life * 90 + 90 ) * 180 , Cos( Entity(UE).Life * 90 - 45 ) * 180
Endif
If Entity(UE).Type_ = 1
Entity(UE).YVel = Entity(UE).YVel - 9.8 * Elapsed#
If Dist3D( Camera Position X() , Camera Position Y() , Camera Position Z() , Entity(UE).X , Entity(UE).Y , Entity(UE).Z ) < 2.0
Entity(UE).Life = -1.0
PolyCount = PolyCount + 1
Endif
If Sc_RayCast( 0 , OldX# , OldY# , OldZ# , Entity(UE).X , Entity(UE).Y , Entity(UE).Z , 0 )
Entity(UE).X = Sc_GetStaticCollisionX()
Entity(UE).Y = Sc_GetStaticCollisionY()
Entity(UE).Z = Sc_GetStaticCollisionZ()
Entity(UE).XVel = Sc_GetCollisionBounceX() * Speed#
Entity(UE).YVel = Sc_GetCollisionBounceY() * Speed#
Entity(UE).ZVel = Sc_GetCollisionBounceZ() * Speed#
Position Object UE + 100 , Entity(UE).X , Entity(UE).Y , Entity(UE).Z
Endif
Else
If Entity(UE).Health <= 0
Entity(UE).Life = -1.0
Endif
AX# = AtanFull( Dist3D( Camera Position X() , 0.0 , Camera Position Z() , Entity(UE).X , 0.0 , Entity(UE).Z ) , Camera Position Y() - Entity(UE).Y )
AY# = AtanFull( Camera Position X() - Entity(UE).X , Camera Position Z() - Entity(UE).Z )
Entity(UE).Breaks = Entity(UE).Breaks - Elapsed#
If Entity(UE).Breaks <= 0.0
If Entity(UE).Breaks < -1
Entity(UE).Breaks = Rnd(5)+2
Endif
Entity(UE).XVel = CurveValue( 0.0 , Entity(UE).XVel , 1.0 / Elapsed# * 0.5 )
Entity(UE).YVel = CurveValue( 0.0 , Entity(UE).YVel , 1.0 / Elapsed# * 0.5 )
Entity(UE).ZVel = CurveValue( 0.0 , Entity(UE).ZVel , 1.0 / Elapsed# * 0.5 )
Else
Entity(UE).XVel = Entity(UE).XVel + Sin( AY# ) * Sin( AX# ) * Entity(UE).Accel
Entity(UE).YVel = Entity(UE).YVel + Cos( AX# ) * Entity(UE).Accel
Entity(UE).ZVel = Entity(UE).ZVel + Cos( AY# ) * Sin( AX# ) * Entity(UE).Accel
Endif
If Speed# > Entity(UE).MaxSpd
Ratio# = Entity(UE).MaxSpd / Speed#
Entity(UE).XVel = Entity(UE).XVel * Ratio#
Entity(UE).YVel = Entity(UE).YVel * Ratio#
Entity(UE).ZVel = Entity(UE).ZVel * Ratio#
Endif
Sc_UpdateObject UE + 100
Endif
Entity(UE).Life = Entity(UE).Life - Elapsed#
If Entity(UE).Life <= 0
Delete Object UE + 100
If Entity(UE).Type_ > 1
Sc_RemoveObject UE + 100
Endif
If Entity(UE).Type_ = 2
For I = 1 To 2
AddEntity( Entity(UE).X , Entity(UE).Y , Entity(UE).Z , 3 )
Next I
Endif
Else
If Entity(UE).Life < 1.0
Set Alpha Mapping On UE + 100 , Entity(UE).Life * 100.0
Endif
Endif
Endif
Next UE
` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
If Escapekey() = 0 And Camera Position Y() < -50.0
Center Text Screen Width() * 0.5 , Screen Height() * 0.5 + 60, "Game Over!"
Center Text Screen Width() * 0.5 , Screen Height() * 0.5, "Score: " + Str$( Score , 0 )
Center Text Screen Width() * 0.5 , Screen Height() - 80 , "Esc to quit"
Sync
Wait Key
Endif
Sync
Loop
` ########################################################################################
` ########################################################################################
` ########################################################################################
Function FireBullet( X As Float , Y As Float , Z As Float , Type_ As Integer , Iterations As Float )
For I = 1 To Iterations
BulID = 0
For UB = 1 To BulletCount
If Bullet(UB).Life <= 0 And Object Exist( UB + 1000 ) = 0
BID = UB
BulID = UB + 1000
Endif
Next UB
If NOT BulID
Array Insert At Bottom Bullet()
BulletCount = BulletCount + 1
BID = BulletCount
BulID = BulletCount + 1000
Endif
Clone Object BulID , 90 + Type_
Disable Object ZDepth BulID
Disable Object ZRead BulID
Bullet(BID).X = X
Bullet(BID).Y = Y
Bullet(BID).Z = Z
Bullet(BID).Type_ = Type_
Bullet(BID).XVel = ( Rnd(100)-50 ) * 0.2 * (Type_ = 2) + Sin( Camera Angle Y() ) * Cos( Camera Angle X() ) * 10.0 * (Type_ = 1)
Bullet(BID).YVel = ( Rnd(100)-50 ) * 0.2 * (Type_ = 2) + - Sin( Camera Angle X() ) * 10.0 * Iterations * (Type_ = 1)
Bullet(BID).ZVel = ( Rnd(100)-50 ) * 0.2 * (Type_ = 2) + Cos( Camera Angle Y() ) * Cos( Camera Angle X() ) * 10.0 * (Type_ = 1)
Bullet(BID).Life = (Type_ = 2) + (5.0 / Iterations) * (Type_ = 1)
ColourObject( BulID , Rgb(255,255,0) )
If Type_ = 1
ColourObject( BulID , Rgb(Rnd(2)*127,Rnd(2)*127,Rnd(2)*127) )
Bullet(BID).EXVel = ( Rnd(100)-50 ) * 0.01 * Iterations
Bullet(BID).EYVel = ( Rnd(100)-50 ) * 0.01 * Iterations
Bullet(BID).EZVel = ( Rnd(100)-50 ) * 0.01 * Iterations
Endif
Next I
EndFunction 0
` ##################################################################################################################################
Function AddEntity( X As Float , Y As Float , Z As Float , Type_ As Integer )
For UE = 1 To EntityCount
If Entity(UE).Life <= 0 And Object Exist( 100 + UE ) = 0
EID = UE
EntID = UE + 100
Endif
Next UE
If NOT EntID
Array Insert At Bottom Entity()
EntityCount = EntityCount + 1
EID = EntityCount
EntID = EntityCount + 100
Endif
Clone Object EntID , 50 + Type_
Position Object EntID , X , Y , Z
Disable Object ZRead EntID
Disable Object ZDepth EntID
ColourObject( EntID , RGB(0,0,0) )
Entity(EID).X = X
Entity(EID).Y = Y
Entity(EID).Z = Z
Entity(EID).Type_ = Type_
Entity(EID).Breaks = Rnd(5)+2
Entity(EID).XVel = 0.0
Entity(EID).YVel = 0.0
Entity(EID).ZVel = 0.0
Entity(EID).Life = 60.0
If Type_ = 1
Entity(EID).XVel = ( Rnd(100)-50 ) * 0.2
Entity(EID).YVel = 0.0
Entity(EID).ZVel = ( Rnd(100)-50 ) * 0.2
Else
Scale Object EntID , 200.0 , 200.0 , 200.0
Sc_SetupObject EntID , 1 , 1
Scale Object EntID , 100.0 , 100.0 , 100.0
Entity(EID).Health = Enemy(Type_,1)
Entity(EID).MaxSpd = Enemy(Type_,2)
Entity(EID).Accel = Enemy(Type_,3)
Entity(EID).Tris = Enemy(Type_,4)
Endif
If Type_ = 3
ColourObject( EntID , RGB(255,255,0) )
Endif
EndFunction 0
` ##################################################################################################################################
Function ColourObject( ObjectID As Dword , Colour As Dword )
Set Object Diffuse ObjectID , Colour
Set Object Emissive ObjectID , Colour
Set Object Specular ObjectID , Colour
Set Object Ambient ObjectID , Colour
Set Object Ambience ObjectID , Colour
EndFunction -1.0
` ##################################################################################################################################
Function Dist3D( X1 As Float , Y1 As Float , Z1 As Float , X2 As Float , Y2 As Float , Z2 As Float )
ReturnValue = SQRT ( ( ( X1 - X2 ) * ( X1 - X2 ) ) + ( ( Y1 - Y2 ) * ( Y1 - Y2 ) ) + ( ( Z1 - Z2 ) * ( Z1 - Z2 ) ) )
EndFunction ReturnValue
` ##################################################################################################################################
Function ReadStr( FileID )
Read String FileID , RetStr$
EndFunction RetStr$
` ##################################################################################################################################
Make Memblock 1 , 1 ` Sparky's awesome DLL!
Type EntityType
X As Float
Y As Float
Z As Float
XVel As Float
YVel As Float
ZVel As Float
Type_ As Float
Life As Float
Health As Integer
MaxSpd As Float
Accel As Float
Breaks As Float
Tris As Integer
Frame As Float
EndType
Type BulletType
X As Float
Y As Float
Z As Float
XVel As Float
YVel As Float
ZVel As Float
Life As Float
Type_ As Integer
EXVel As Float
EYVel As Float
EZVel As Float
EndType
Compressed code:
Load DLL "user32.dll",1 : DisplayX = Call DLL( 1 , "GetSystemMetrics" , 0 ) : DisplayY = Call DLL( 1 , "GetSystemMetrics" , 1 ) : Set Display Mode DisplayX , DisplayY , 32 , 1 : Sync On : AutoCam Off : Hide Mouse : Set Text Size 40 : Ink 0,0 : Global BulletCount , EntityCount : Global PolyCount As Integer : PolyCount = 50 : Load Object "Data/Maps/Skysphere.x" , 10 : Set Object Light 10 , 0 : Dim Bullet(0) As BulletType : Dim Entity(0) As EntityType : Dim Enemy(20,5) As Float : Open To Read 1 , "Data/Spawn.dat" : Open To Read 2 , "Data/Enemies.dat" : For I = 1 To 2 : Load Object "Data/Weapons/Bullet" + Str$(I) + ".X" , 90 + I : Hide Object 90 + I : Set Object Transparency 90 + I , 2 : Next I : For I = 1 To 6
Load Object "Data/Weapons/Entity" + Str$(I) + ".X" , 50 + I : Hide Object 50 + I : Set Object Transparency 50 + I , 2 : For X = 1 To 4 : Enemy(I,X) = Val(ReadStr(2)) : Next X : Next I : Load Object "Data/Weapons/Pistol/Pistol.x" , 1 : Load Sound "Data/Weapons/Pistol/Fire.wav" , 1 : Disable Object ZDepth 1 : Load Object "Data/Weapons/Muzzle.x" , 3 : Set Object Transparency 3 , 2 : Disable Object ZDepth 3 : ColourObject( 3 , RGB(255,255,100) ) : Load Object "Data/Maps/Map1.x" , 2 : Set Object Transparency 2 , 2 : Sc_SetupComplexObject 2 , 0 , 2 : OldTime = Timer() : Do : Center Text Screen Width() * 0.5 , 10, "Score: " + Str$( Score , 0 ) : Text 40 , Screen Height() - 60, "Ammo: " + Str$( PolyCount ) : Center Text Screen Width() * 0.5 , 200 - CurrentTime# * CurrentTime# * 10 , "Don't fall off the platform!" : Elapsed# = ( Timer() - OldTime ) * 0.001 : OldTime = Timer() : CameraAX# = CameraAX# + (MouseMoveY()*1.0)*0.4
CameraAY# = CameraAY# + (MouseMoveX()*1.0)*0.4 : If CameraAX# > 80.0 : CameraAX# = 80.0 : Endif : If CameraAX# < -80.0 : CameraAX# = -80.0 : Endif : Rotate Camera CurveValue ( CameraAX# , Camera Angle X() , 1.0 / Elapsed# * 0.1 ) , CurveValue ( CameraAY# , Camera Angle Y() , 1.0 / Elapsed# * 0.1 ) , Camera Angle Z() : FireWait# = FireWait# - Elapsed# : Set Object Frame 1 ,Sin (Frame#) : Frame# = Frame# + Elapsed# * 1500 : If Frame# > 180.0 : Frame# = 180.0 : Set Object Frame 1 , PolyCount = 0 : Endif : Scale Object 3 ,(MouseClick() > 0 And MouseClick() <= 2 And PolyCount >= MouseClick() And OldMouse = 0)*100 , 100 , 100 : If MouseClick() > 0 And MouseClick() <= 2 And PolyCount >= MouseClick() And OldMouse = 0 : CamDevX# = CamDevX# - 5.0 : PolyCount = PolyCount - MouseClick() : Play Sound 1 : Frame# = FireBullet( Limb Position X( 1 , 5 ) , Limb Position Y( 1 , 5 ) , Limb Position Z( 1 , 5 ) , 1 , MouseClick() ) : Endif : OldMouse = MouseClick() : PlayerXVel# = CurveValue ( KeyState (32) - KeyState (30) , PlayerXVel# , 1.0 / Elapsed# * 0.4 ) : PlayerZVel# = CurveValue ( KeyState (17) - KeyState (31) , PlayerZVel# , 1.0 / Elapsed# * 0.4 )
If (Abs ( PlayerXVel# ) + Abs ( PlayerZVel# )) >= 1.0 : Ratio# = 1.0 / (Abs ( PlayerXVel# ) + Abs ( PlayerZVel# )) : PlayerXVel# = PlayerXVel# * Ratio# : PlayerZVel# = PlayerZVel# * Ratio# : Endif : PlayerX# = PlayerX# + Sin ( Camera Angle Y() + AtanFull(PlayerXVel#,PlayerZVel#) ) * (Abs ( PlayerXVel# ) + Abs ( PlayerZVel# )) * Elapsed# * 8.0 : PlayerY# = PlayerY# + PlayerYVel# * Elapsed# : PlayerZ# = PlayerZ# + Cos ( Camera Angle Y() + AtanFull(PlayerXVel#,PlayerZVel#) ) * (Abs ( PlayerXVel# ) + Abs ( PlayerZVel# )) * Elapsed# * 8.0 : If Sc_SphereSlide( 0 , OldPX# , OldPY# - 1.3 , OldPZ# , PlayerX# + 0.001 , PlayerY# - 1.3 , PlayerZ# , 0.5 , 0 ) : PlayerX# = Sc_GetCollisionSlideX() : PlayerY# = Sc_GetCollisionSlideY() + 1.3 : PlayerZ# = Sc_GetCollisionSlideZ() : Endif : If Sc_RayCast( 2 , OldPX# , OldPY# , OldPZ# , PlayerX# , PlayerY# - 1.85 , PlayerZ# , 0) : PlayerYVel# = SpaceKey() * 4.0 : PlayerY# = Sc_GetStaticCollisionY() + 1.8 : Else : PlayerYVel# = PlayerYVel# - 9.8 * Elapsed# : Endif : OldPX# = PlayerX# : OldPY# = PlayerY# : OldPZ# = PlayerZ# : Position Camera PlayerX# , PlayerY# , PlayerZ# : CamDevX# = CurveValue( 0.0 , CamDevX# , 1.0 / Elapsed# * 0.1 ) : Position Object 1 , Camera Position X() , Camera Position Y() , Camera Position Z()
Position Object 3 , Camera Position X() , Camera Position Y() , Camera Position Z() : Position Object 10 , Camera Position X() , Camera Position Y() , Camera Position Z() : Rotate Object 1 , Camera Angle X() + ( Camera Angle X() - CameraAX# ) * 0.5 + CamDevX# , Camera Angle Y() + ( Camera Angle Y() - CameraAY# ) * 0.5 + CamDevY# , Camera Angle Z() : Rotate Object 3 , Camera Angle X() + ( Camera Angle X() - CameraAX# ) * 0.5 + CamDevX# , Camera Angle Y() + ( Camera Angle Y() - CameraAY# ) * 0.5 + CamDevY# , Camera Angle Z() : Rotate Limb 3 , 1 , 0 , Timer() , 0 : Rotate Limb 3 , 2 , 0 , Timer() , 0 : CurrentTime# = CurrentTime# + Elapsed# : If NOT NextTime : NextTime = Val(ReadStr( 1 )) : NextSpawn = Val(ReadStr( 1 )) : Else : If NextTime < CurrentTime# : NextTime = AddEntity( Sin(Timer()) * 100.0 , 20.0 , Cos(Timer()) * 100.0 , NextSpawn ) : Endif : Endif : ColourObject( 2 , Rgb( Abs(Sin(CurrentTime#*10)) * 255 , Abs(Cos(CurrentTime#*10)) * 255 , Abs(Cos(CurrentTime#*10+90)) * 255 ) ) : For UB = 1 To BulletCount : If Bullet(UB).Life > 0 : OldX# = Bullet(UB).X : OldY# = Bullet(UB).Y : OldZ# = Bullet(UB).Z : Bullet(UB).X = Bullet(UB).X + ( Bullet(UB).XVel + Bullet(UB).EXVel ) * Elapsed# : Bullet(UB).Y = Bullet(UB).Y + ( Bullet(UB).YVel + Bullet(UB).EYVel ) * Elapsed# : Bullet(UB).Z = Bullet(UB).Z + ( Bullet(UB).ZVel + Bullet(UB).EZVel ) * Elapsed# : Position Object UB + 1000 , Bullet(UB).X , Bullet(UB).Y , Bullet(UB).Z
Point Object UB + 1000 , Camera Position X() , Camera Position Y() , Camera Position Z() : Bullet(UB).X = Object Position X (UB + 1000) : Bullet(UB).Y = Object Position Y (UB + 1000) : Bullet(UB).Z = Object Position Z (UB + 1000) : If Bullet(UB).Type_ = 1 : Roll Object Right UB + 1000 , Bullet(UB).Life * 180.0 : Bullet(UB).EXVel = Bullet(UB).EXVel * 1.01 : Bullet(UB).EYVel = Bullet(UB).EYVel * 1.01 : Bullet(UB).EZVel = Bullet(UB).EZVel * 1.01 : If Sc_RayCast( 0 , OldX#-(Bullet(UB).X-OldX#)*10.0 , OldY#-(Bullet(UB).Y-OldY#)*10.0 , OldZ#-(Bullet(UB).Z-OldZ#)*10.0 , Bullet(UB).X, Bullet(UB).Y, Bullet(UB).Z , 0 ) : Bullet(UB).X = Sc_GetStaticCollisionX() : Bullet(UB).Y = Sc_GetStaticCollisionY() : Bullet(UB).Z = Sc_GetStaticCollisionZ() : Speed# = Dist3D( 0.0 , 0.0 , 0.0 , Bullet(UB).XVel + Bullet(UB).EXVel , Bullet(UB).YVel + Bullet(UB).EYVel , Bullet(UB).ZVel + Bullet(UB).EZVel ) : Bullet(UB).XVel = Sc_GetCollisionBounceX() * Speed# * 0.5 : Bullet(UB).YVel = Sc_GetCollisionBounceY() * Speed# * 0.5 : Bullet(UB).ZVel = Sc_GetCollisionBounceZ() * Speed# * 0.5 : Bullet(UB).EXVel = Sc_GetCollisionBounceX() * Speed# * 0.5 : Bullet(UB).EYVel = Sc_GetCollisionBounceY() * Speed# * 0.5 : Bullet(UB).EZVel = Sc_GetCollisionBounceZ() * Speed# * 0.5 : Position Object UB + 1000 , Bullet(UB).X , Bullet(UB).Y , Bullet(UB).Z : For I = 1 To Rnd(15) + 5 : FireBullet( Bullet(UB).X , Bullet(UB).Y , Bullet(UB).Z , 2 , 1 ) : Next I : If Sc_GetObjectHit() >= 100 And Sc_GetObjectHit() <= 100 + EntityCount And Bullet(UB).Type_ = 1
EntID = Sc_GetObjectHit() - 100 : Hits = Hits + 1 : If Entity(EntID).Life > 0 : If Entity(EntID).Type_ > 1 : Entity(EntID).Health = Entity(EntID).Health - 1 : Entity(EntID).Breaks = -0.5 : If Entity(EntID).Health = 0 : Score = CurrentTime# * Hits : Rand = Rnd(Entity(EntID).Tris) + 2 : For I = 1 To Rand : AddEntity( Entity(EntID).X , Entity(EntID).Y , Entity(EntID).Z , 1 ) : Next I : Endif : Bullet(UB).Life = ColourObject( Sc_GetObjectHit() , RGB( 255 - Entity(EntID).Health * (255/Enemy(Int(Entity(EntID).Type_),1)) , 0 , 0 ) ) : Endif : Endif : Endif : Endif : Else : Roll Object Right UB + 1000 , Bullet(UB).Life * 360.0 : Endif : Bullet(UB).Life = Bullet(UB).Life - Elapsed# : If Bullet(UB).Life < 1.0 : Set Alpha Mapping On UB + 1000 , Bullet(UB).Life * 100.0 : Endif
If Bullet(UB).Life <= 0 : Delete Object UB + 1000 : Bullet(UB).EXVel = 0.0 : Bullet(UB).EYVel = 0.0 : Bullet(UB).EZVel = 0.0 : Endif : Endif : Next UB : For UE = 1 To EntityCount : If Entity(UE).Life > 0 Or Object Exist(UE + 100) : OldX# = Entity(UE).X : OldY# = Entity(UE).Y : OldZ# = Entity(UE).Z : Speed# = Dist3D( 0.0 , 0.0 , 0.0 , Entity(UE).XVel , Entity(UE).YVel , Entity(UE).ZVel ) : Entity(UE).X = Entity(UE).X + Entity(UE).XVel * Elapsed# : Entity(UE).Y = Entity(UE).Y + Entity(UE).YVel * Elapsed# : Entity(UE).Z = Entity(UE).Z + Entity(UE).ZVel * Elapsed# : Position Object UE + 100 , Entity(UE).X , Entity(UE).Y , Entity(UE).Z : Point Object UE + 100 , Camera Position X() , Camera Position Y() , Camera Position Z() : Entity(UE).X = Object Position X (UE + 100) : Entity(UE).Y = Object Position Y (UE + 100) : Entity(UE).Z = Object Position Z (UE + 100) : If Entity(UE).Y < -110.0 : Entity(UE).Life = -1.0 : Endif
If Entity(UE).Type_ > 3 : Rotate Object UE + 100 , Sin( Entity(UE).Life * 90 ) * 180 , Cos( Entity(UE).Life * 90 + 90 ) * 180 , Cos( Entity(UE).Life * 90 - 45 ) * 180 : Endif : If Entity(UE).Type_ = 1 : Entity(UE).YVel = Entity(UE).YVel - 9.8 * Elapsed# : If Dist3D( Camera Position X() , Camera Position Y() , Camera Position Z() , Entity(UE).X , Entity(UE).Y , Entity(UE).Z ) < 2.0 : Entity(UE).Life = -1.0 : PolyCount = PolyCount + 1 : Endif : If Sc_RayCast( 0 , OldX# , OldY# , OldZ# , Entity(UE).X , Entity(UE).Y , Entity(UE).Z , 0 ) : Entity(UE).X = Sc_GetStaticCollisionX() : Entity(UE).Y = Sc_GetStaticCollisionY() : Entity(UE).Z = Sc_GetStaticCollisionZ() : Entity(UE).XVel = Sc_GetCollisionBounceX() * Speed# : Entity(UE).YVel = Sc_GetCollisionBounceY() * Speed# : Entity(UE).ZVel = Sc_GetCollisionBounceZ() * Speed# : Position Object UE + 100 , Entity(UE).X , Entity(UE).Y , Entity(UE).Z : Endif : Else : If Entity(UE).Health <= 0 : Entity(UE).Life = -1.0 : Endif : AX# = AtanFull( Dist3D( Camera Position X() , 0.0 , Camera Position Z() , Entity(UE).X , 0.0 , Entity(UE).Z ) , Camera Position Y() - Entity(UE).Y ) : AY# = AtanFull( Camera Position X() - Entity(UE).X , Camera Position Z() - Entity(UE).Z ) : Entity(UE).Breaks = Entity(UE).Breaks - Elapsed#
If Entity(UE).Breaks <= 0.0 : If Entity(UE).Breaks < -1 : Entity(UE).Breaks = Rnd(5)+2 : Endif : Entity(UE).XVel = CurveValue( 0.0 , Entity(UE).XVel , 1.0 / Elapsed# * 0.5 ) : Entity(UE).YVel = CurveValue( 0.0 , Entity(UE).YVel , 1.0 / Elapsed# * 0.5 ) : Entity(UE).ZVel = CurveValue( 0.0 , Entity(UE).ZVel , 1.0 / Elapsed# * 0.5 ) : Else : Entity(UE).XVel = Entity(UE).XVel + Sin( AY# ) * Sin( AX# ) * Entity(UE).Accel : Entity(UE).YVel = Entity(UE).YVel + Cos( AX# ) * Entity(UE).Accel : Entity(UE).ZVel = Entity(UE).ZVel + Cos( AY# ) * Sin( AX# ) * Entity(UE).Accel : Endif : If Speed# > Entity(UE).MaxSpd : Ratio# = Entity(UE).MaxSpd / Speed# : Entity(UE).XVel = Entity(UE).XVel * Ratio# : Entity(UE).YVel = Entity(UE).YVel * Ratio# : Entity(UE).ZVel = Entity(UE).ZVel * Ratio# : Endif : Sc_UpdateObject UE + 100 : Endif : Entity(UE).Life = Entity(UE).Life - Elapsed# : If Entity(UE).Life <= 0 : Delete Object UE + 100 : If Entity(UE).Type_ > 1 : Sc_RemoveObject UE + 100
Endif : If Entity(UE).Type_ = 2 : For I = 1 To 2 : AddEntity( Entity(UE).X , Entity(UE).Y , Entity(UE).Z , 3 ) : Next I : Endif : Else : If Entity(UE).Life < 1.0 : Set Alpha Mapping On UE + 100 , Entity(UE).Life * 100.0 : Endif : Endif : Endif : Next UE : If Escapekey() = 0 And Camera Position Y() < -50.0 : Center Text Screen Width() * 0.5 , Screen Height() * 0.5 + 60, "Game Over!" : Center Text Screen Width() * 0.5 , Screen Height() * 0.5, "Score: " + Str$( Score , 0 ) : Center Text Screen Width() * 0.5 , Screen Height() - 80 , "Esc to quit" : Sync : Wait Key : Endif : Sync : Loop
Function FireBullet( X As Float , Y As Float , Z As Float , Type_ As Integer , Iterations As Float ) : For I = 1 To Iterations : BulID = 0 : For UB = 1 To BulletCount : If Bullet(UB).Life <= 0 And Object Exist( UB + 1000 ) = 0 : BID = UB : BulID = UB + 1000 : Endif : Next UB : If NOT BulID : Array Insert At Bottom Bullet() : BulletCount = BulletCount + 1 : BID = BulletCount : BulID = BulletCount + 1000 : Endif : Clone Object BulID , 90 + Type_ : Disable Object ZDepth BulID : Disable Object ZRead BulID : Bullet(BID).X = X : Bullet(BID).Y = Y : Bullet(BID).Z = Z : Bullet(BID).Type_ = Type_ : Bullet(BID).XVel = ( Rnd(100)-50 ) * 0.2 * (Type_ = 2) + Sin( Camera Angle Y() ) * Cos( Camera Angle X() ) * 10.0 * (Type_ = 1) : Bullet(BID).YVel = ( Rnd(100)-50 ) * 0.2 * (Type_ = 2) + - Sin( Camera Angle X() ) * 10.0 * Iterations * (Type_ = 1) : Bullet(BID).ZVel = ( Rnd(100)-50 ) * 0.2 * (Type_ = 2) + Cos( Camera Angle Y() ) * Cos( Camera Angle X() ) * 10.0 * (Type_ = 1)
Bullet(BID).Life = (Type_ = 2) + (5.0 / Iterations) * (Type_ = 1) : ColourObject( BulID , Rgb(255,255,0) ) : If Type_ = 1 : ColourObject( BulID , Rgb(Rnd(2)*127,Rnd(2)*127,Rnd(2)*127) ) : Bullet(BID).EXVel = ( Rnd(100)-50 ) * 0.01 * Iterations : Bullet(BID).EYVel = ( Rnd(100)-50 ) * 0.01 * Iterations : Bullet(BID).EZVel = ( Rnd(100)-50 ) * 0.01 * Iterations : Endif : Next I
EndFunction 0 : Function AddEntity( X As Float , Y As Float , Z As Float , Type_ As Integer ) : For UE = 1 To EntityCount : If Entity(UE).Life <= 0 And Object Exist( 100 + UE ) = 0 : EID = UE : EntID = UE + 100 : Endif : Next UE : If NOT EntID : Array Insert At Bottom Entity() : EntityCount = EntityCount + 1 : EID = EntityCount : EntID = EntityCount + 100 : Endif : Clone Object EntID , 50 + Type_ : Position Object EntID , X , Y , Z : Disable Object ZRead EntID : Disable Object ZDepth EntID : ColourObject( EntID , RGB(0,0,0) ) : Entity(EID).X = X : Entity(EID).Y = Y : Entity(EID).Z = Z : Entity(EID).Type_ = Type_ : Entity(EID).Breaks = Rnd(5)+2 : Entity(EID).XVel = 0.0
Entity(EID).YVel = 0.0 : Entity(EID).ZVel = 0.0 : Entity(EID).Life = 60.0 : If Type_ = 1 : Entity(EID).XVel = ( Rnd(100)-50 ) * 0.2 : Entity(EID).YVel = 0.0 : Entity(EID).ZVel = ( Rnd(100)-50 ) * 0.2 : Else : Scale Object EntID , 200.0 , 200.0 , 200.0 : Sc_SetupObject EntID , 1 , 1 : Scale Object EntID , 100.0 , 100.0 , 100.0 : Entity(EID).Health = Enemy(Type_,1) : Entity(EID).MaxSpd = Enemy(Type_,2) : Entity(EID).Accel = Enemy(Type_,3) : Entity(EID).Tris = Enemy(Type_,4) : Endif : If Type_ = 3 : ColourObject( EntID , RGB(255,255,0) ) : Endif
EndFunction 0 : Function ColourObject( ObjectID As Dword , Colour As Dword ) : Set Object Diffuse ObjectID , Colour : Set Object Emissive ObjectID , Colour : Set Object Specular ObjectID , Colour : Set Object Ambient ObjectID , Colour : Set Object Ambience ObjectID , Colour
EndFunction -1.0 : Function Dist3D( X1 As Float , Y1 As Float , Z1 As Float , X2 As Float , Y2 As Float , Z2 As Float ) : ReturnValue = SQRT ( ( ( X1 - X2 ) * ( X1 - X2 ) ) + ( ( Y1 - Y2 ) * ( Y1 - Y2 ) ) + ( ( Z1 - Z2 ) * ( Z1 - Z2 ) ) )
EndFunction ReturnValue : Function ReadStr( FileID ) : Read String FileID , RetStr$
EndFunction RetStr$ : Make Memblock 1 , 1
Type EntityType X As Float : Y As Float : Z As Float : XVel As Float : YVel As Float : ZVel As Float : Type_ As Float : Life As Float : Health As Integer : MaxSpd As Float : Accel As Float : Breaks As Float : Tris As Integer : Frame As Float EndType Type BulletType X As Float : Y As Float : Z As Float : XVel As Float : YVel As Float : ZVel As Float : Life As Float : Type_ As Integer : EXVel As Float : EYVel As Float : EZVel As Float EndType
Notes?
This code may not be the best to learn from because I spent the past few hours trying to shave off extra lines of code, leading to some rather stupid optimizations.
To compile the code you need Sparky's DLL
http://forum.thegamecreators.com/?m=forum_view&t=74762&b=5
Also the game has media so download the file below and it comes with a .exe .