Ok, code is what you want then code you'll get. Just keep in mind that the entire source at the moment covers 1684 lines, so I don't think I'll post it. Anyway, here is the map-creation code (I've built an own system for loading maps):
function LoadMap(name as string)
if not file exist("maps/" + name) then exitfunction 0
widthX as integer
widthZ as integer
height as integer
ind as boolean
in as string
open to read 1, "maps/" + name
rem Read the dimensions of the arena
read string 1, in
widthX = val( in )
read string 1, in
widthZ = val( in )
read string 1, in
height = val( in )
rem Read and assign the gravity
read string 1, in
gravitySpeed = val( in )
phy set gravity 0, gravitySpeed, 0
dim loaded( 0 ) as _image_
dim room( 3 ) as string
rem Create the arena
obj = GetNewObjectNumber()
make object box obj, widthX * 100 + 10, 1000, widthZ * 100 + 10
position object obj, widthX * 50, -500, widthZ * 50
phy make rigid body static box obj
hide object obj
ground = obj
obj = GetNewObjectNumber()
make object plain obj, widthX * 100, widthZ * 100
position object obj, widthX * 50, 0, widthZ * 50
xrotate object obj, 90
Colors( obj )
read string 1, room( 3 )
if room( 3 ) <> "none" and room( 3 ) <> "no texture"
scale object texture obj, widthX, widthZ
SetTexture( obj )
endif
obj = GetNewObjectNumber()
make object box obj, widthX * 100 + 10, 1000, widthZ * 100 + 10
position object obj, widthX * 50, height * 100 + 500, widthZ * 50
phy make rigid body static box obj
hide object obj
obj = GetNewObjectNumber()
make object plain obj, widthX * 100, widthZ * 100
position object obj, widthX * 50, height * 100, widthZ * 50
xrotate object obj, 90
Colors( obj )
read string 1, room( 3 )
if room( 3 ) <> "none" and room( 3 ) <> "no texture"
scale object texture obj, widthX, widthZ
SetTexture( obj )
endif
obj = GetNewObjectNumber()
make object box obj, widthX * 100 + 10, height * 100 + 10, 1000
position object obj, widthX * 50, height * 50, -500
phy make rigid body static box obj
hide object obj
obj = GetNewObjectNumber()
make object plain obj, widthX * 100, height * 100
position object obj, widthX * 50, height * 50, 0
Colors( obj )
read string 1, room( 3 )
if room( 3 ) <> "none" and room( 3 ) <> "no texture"
if room( 3 ) = "individual textures"
ind = 1
read string 1, room( 3 )
endif
scale object texture obj, widthX, height
SetTexture( obj )
endif
obj = GetNewObjectNumber()
make object box obj, widthX * 100 + 10, height * 100 + 10, 1000
position object obj, widthX * 50, height * 50, widthZ * 100 + 500
phy make rigid body static box obj
hide object obj
obj = GetNewObjectNumber()
make object plain obj, widthX * 100, height * 100
position object obj, widthX * 50, height * 50, widthZ * 100
Colors( obj )
if room( 3 ) <> "none" and room( 3 ) <> "no texture"
if ind = 1
read string 1, room( 3 )
endif
scale object texture obj, widthX, height
SetTexture( obj )
endif
obj = GetNewObjectNumber()
make object box obj, 1000, height * 100 + 10, widthZ * 100 + 10
position object obj, -500, height * 50, widthZ * 50
phy make rigid body static box obj
hide object obj
obj = GetNewObjectNumber()
make object plain obj, widthZ * 100, height * 100
position object obj, 0, height * 50, widthZ * 50
yrotate object obj, 90
Colors( obj )
if room( 3 ) <> "none" and room( 3 ) <> "no texture"
if ind = 1
read string 1, room( 3 )
endif
scale object texture obj, widthZ, height
SetTexture( obj )
endif
obj = GetNewObjectNumber()
make object box obj, 1000, height * 100 + 10, widthZ * 100 + 10
position object obj, widthX * 100 + 500, height * 50, widthZ * 50
phy make rigid body static box obj
hide object obj
obj = GetNewObjectNumber()
make object plain obj, widthZ * 100, height * 100
position object obj, widthX * 100, height * 50, widthZ * 50
yrotate object obj, 90
Colors( obj )
if room( 3 ) <> "none" and room( 3 ) <> "no texture"
if ind = 1
read string 1, room( 3 )
endif
scale object texture obj, widthZ, height
SetTexture( obj )
endif
rem Read and assign the static and dynamic friction
read string 1, in
phy set static friction val( in )
read string 1, in
phy set dynamic friction val( in )
rem Set the fog
read string 1, in
if in = "on"
fog on
read string 1, in
fog distance val( in )
endif
rem Fill the arena
while file end( 1 ) = 0
rem Read from the file
read string 1, in
read string 1, room( 0 )
read string 1, room( 1 )
read string 1, room( 2 )
read string 1, room( 3 )
rem Create world
select in
case "small box"
rem Create an small box
obj = GetNewObjectNumber()
make object cube obj, 26
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body dynamic box obj, 1
phy set rigid body mass obj, 70
rem Store the object number in the arrays
objects( obj ) = obj
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
endcase
case "small boxes"
rem Create an pile of small boxes
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object cube obj, 26
position object obj, val( room( 1 ) ) - 13, 26 * n - 13, val( room( 2 ) ) - 13
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body dynamic box obj, 1
phy set rigid body mass obj, 70
objects( obj ) = obj
rem Store the object number in the arrays
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
next n
endcase
case "small static box"
rem Create an small static box
obj = GetNewObjectNumber()
make object cube obj, 26
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static box obj
endcase
case "small static boxes"
rem Create an pile of small static boxes
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object cube obj, 26
position object obj, val( room( 1 ) ) - 13, 26 * n - 13, val( room( 2 ) ) - 13
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static box obj
next n
endcase
case "medium box"
rem Create an medium box
obj = GetNewObjectNumber()
make object cube obj, 82
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body dynamic box obj, 1
phy set rigid body mass obj, 163
rem Store the object number in the arrays
objects( obj ) = obj
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
endcase
case "medium boxes"
rem Create an pile of medium boxes
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object cube obj, 82
position object obj, val( room( 1 ) ) - 41, 82 * n - 41, val( room( 2 ) ) - 41
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body dynamic box obj, 1
phy set rigid body mass obj, 163
rem Store the object number in the arrays
objects( obj ) = obj
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
next n
endcase
case "medium static box"
rem Create an medium static box
obj = GetNewObjectNumber()
make object cube obj, 82
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static box obj
endcase
case "medium static boxes"
rem Create an pile of medium static boxes
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object cube obj, 82
position object obj, val( room( 1 ) ) - 41, 82 * n - 41, val( room( 2 ) ) - 41
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static box obj
next n
endcase
case "large box"
rem Create an large box
obj = GetNewObjectNumber()
make object cube obj, 208
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body dynamic box obj, 1
phy set rigid body mass obj, 1001
rem Store the object number in the arrays
objects( obj ) = obj
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
endcase
case "large boxes"
rem Create an pile of larger boxes
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object cube obj, 208
position object obj, val( room( 1 ) ) - 104, 208 * n - 104, val( room( 2 ) ) - 104
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body dynamic box obj, 1
phy set rigid body mass obj, 1001
rem Store the object number in the arrays
objects( obj ) = obj
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
next n
endcase
case "large static box"
rem Create an large box
obj = GetNewObjectNumber()
make object cube obj, 208
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static box obj
endcase
case "large static boxes"
rem Create an pile of larger boxes
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object cube obj, 208
position object obj, val( room( 1 ) ) - 104, 208 * n - 104, val( room( 2 ) ) - 104
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static box obj
next n
endcase
case "small sphere"
rem Create an small sphere
obj = GetNewObjectNumber()
make object sphere obj, 26
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy set rigid body mass obj, 70
phy make rigid body dynamic sphere obj, 2
rem Store the object number in the arrays
objects( obj ) = obj
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
endcase
case "small spheres"
rem Create an pile of smaller spheres
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object sphere obj, 26
position object obj, val( room( 1 ) ) - 104, 208 * n - 104, val( room( 2 ) ) - 104
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy set rigid body mass obj, 70
phy make rigid body dynamic sphere obj, 2
rem Store the object number in the arrays
objects( obj ) = obj
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
next n
endcase
case "small static sphere"
rem Create an small static sphere
obj = GetNewObjectNumber()
make object sphere obj, 26
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static sphere obj
endcase
case "small static spheres"
rem Create an pile of smaller static spheres
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object sphere obj, 26
position object obj, val( room( 1 ) ) - 104, 208 * n - 104, val( room( 2 ) ) - 104
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static sphere obj
next n
endcase
case "medium sphere"
rem Create an medium sphere
obj = GetNewObjectNumber()
make object sphere obj, 82
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy set rigid body mass obj, 163
phy make rigid body dynamic sphere obj, 2
rem Store the object number in the arrays
objects( obj ) = obj
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
endcase
case "medium spheres"
rem Create an pile of medium spheres
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object sphere obj, 82
position object obj, val( room( 1 ) ) - 104, 208 * n - 104, val( room( 2 ) ) - 104
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy set rigid body mass obj, 163
phy make rigid body dynamic sphere obj, 2
rem Store the object number in the arrays
objects( obj ) = obj
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
next n
endcase
case "medium static sphere"
rem Create an medium static sphere
obj = GetNewObjectNumber()
make object sphere obj, 82
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static sphere obj
endcase
case "medium static spheres"
rem Create an pile of medium static spheres
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object sphere obj, 82
position object obj, val( room( 1 ) ) - 104, 208 * n - 104, val( room( 2 ) ) - 104
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static sphere obj
next n
endcase
case "large sphere"
rem Create an larger sphere
obj = GetNewObjectNumber()
make object sphere obj, 208
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy set rigid body mass obj, 807
phy make rigid body dynamic sphere obj, 2
rem Store the object number in the arrays
objects( obj ) = obj
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
endcase
case "large spheres"
rem Create an pile of larger spheres
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object sphere obj, 208
position object obj, val( room( 1 ) ) - 104, 208 * n - 104, val( room( 2 ) ) - 104
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy set rigid body mass obj, 807
phy make rigid body dynamic sphere obj, 2
rem Store the object number in the arrays
objects( obj ) = obj
array insert at bottom objectsI()
objectsI( array count( objectsI() ) ) = obj
next n
endcase
case "large static sphere"
rem Create an large static sphere
obj = GetNewObjectNumber()
make object sphere obj, 208
position object obj, val( room( 0 ) ), val( room( 1 ) ), val( room( 2 ) )
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static sphere obj
endcase
case "large static spheres"
rem Create an pile of larger static spheres
for n = 1 to val( room( 0 ) )
obj = GetNewObjectNumber()
make object sphere obj, 208
position object obj, val( room( 1 ) ) - 104, 208 * n - 104, val( room( 2 ) ) - 104
Colors( obj )
if room( 3 ) <> "no texture" and file exist( "textures/" + room( 3 ) )
SetTexture( obj )
endif
phy make rigid body static sphere obj
next n
endcase
case "spawn point"
rem Create an spawnpoint
array insert at top spawn()
spawn( 0 ).x = val( room( 0 ) )
spawn( 0 ).y = val( room( 1 ) )
spawn( 0 ).z = val( room( 2 ) )
if room( 3 ) <> "none"
obj = GetNewObjectNumber()
make object sphere obj, 50
position object obj, spawn( 0 ).x, spawn( 0 ).y, spawn( 0 ).z
ghost object on obj
if room( 3 ) = "red"
color object obj, rgb(255, 0, 0)
else
if room( 3 ) = "blue"
color object obj, rgb(0, 0, 255)
else
if room( 3 ) = "green"
color object obj, rgb(0, 255, 0)
else
if room( 3 ) = "black"
color object obj, 0
endif
endif
endif
endif
endif
endcase
endselect
endwhile
undim room()
undim loaded()
close file 1
endfunction 1
If the problem is not here, I don't know where it might be. Because the game I'm working on pushes the capabilities of Dark Physics to it's limits.
Anyway, I've attatched the game itself to. Just want to know if you get the same bug, or if it's my computer. And if you do, know that the source itself is attatched to, so you can take a closer look at it if you want to.