Hi!
I have written some code that sets up 'boundaries' for my level.
Here is the code:
for y = 1 to num_wallObjsY
make object box wallObjsNum, width,height,depth
position Object wallObjsNum,posX,posY,posZ
texture object wallObjsNum,1
sc_setupObject wallObjsNum,1,0
inc wallObjsNum,1
posY = posY + 100
NEXT y
posY = posY -50
posX = posX + 50
for x = 1 to num_wallObjsX
make object box wallObjsNum, width,height,depth
zrotate object wallObjsNum,90
position Object wallObjsNum,posX,posY,posZ
texture object wallObjsNum,1
sc_setupObject wallObjsNum,1,0
inc wallObjsNum,1
posX = posX + 100
NEXT x
posY = 0
posX = posX - 50
for y = 1 to num_wallObjsY
make object box wallObjsNum, width,height,depth
position Object wallObjsNum,posX,posY,posZ
texture object wallObjsNum,1
sc_setupObject wallObjsNum,1,0
inc wallObjsNum,1
posY = posY + 100
NEXT y
posY = 0
posX = 0
posX = posX + 50
posY = posY - 50
for x = 1 to num_wallObjsX
make object box wallObjsNum, width,height,depth
zrotate object wallObjsNum,90
position Object wallObjsNum,posX,posY,posZ
texture object wallObjsNum,1
sc_setupObject wallObjsNum,1,0
inc wallObjsNum,1
posX = posX + 100
NEXT x
As you can see I set the posX and posY varibles with different values before it enters each for loop. This is necessary otherwise all loops would start at the same 'spot'
Here's question one: The setting of these values is also to adjust the object so that it falls in the right position due to world coordinates 0,0,0 is in the center of the mass of each object. Positioning two wall objects with different angles in the same position would just show up like a big + sign.
I belive this can be changed using the offset limb command, so that the walls can be more easily placed, think of segments from fpsc.
Would this be a method I should consider or should I stick with mine?
Question 2 is about the possible lag issue:
When I run the program I experience som lagging every now and then and I suspect that my code for updating every level object in the main loop can have something to do with it. I'm Using sparky's collision and in the end of the loop I update every single object in the scene in a foor loop. This is many object.
Maybe if I make one large mesh of the level and only updates that one, or If I split up the level in larger meshes, but yet fewer than every level object so that the program does not have to update so many objects?
BEST!
www.memblockgames.com