Yeah, it's still unclear what you mean. Is this what you are talking about:
Global maxLevel=4
Global level
...
; main loop
level=level+1
if level > maxLevel then level=1
Select level
Case 1
...
Case 2
...
Case 3
...
Case 4
...
Default
...
End Select
(I'm not sure the syntax is correct here...)
or maybe...
Global maxBaddies=10
Global numBaddies=0
Global baddieTimer=0
Global newBaddieTime=100
...
; main loop
baddieTimer=baddieTimer+1
If baddieTimer>newBaddieTime and numBaddies<maxBaddies
baddieTimer=0
numBaddies=numBaddies+1
CreateBaddie()
End If
As to efficiently storing information about levels: The general answer to storing information more efficiently is: Use types. Most people (I think) just put everything (inanimate objects) into one mesh for each level. So, you could create a Level type, like this:
Type Level
Field levelMesh
Field numBaddies
Field newBaddieTime
Field baseBaddieMesh ; Using CopyEntity() to create each one
End Type
...But what if you want things to move around, other than baddies? You wouldn't want to store them in the Level type, because you would be locked into an exact number. But you could store movable level objects in their own type, and have that type refer to the level. And since there could be many instances of each kind of thing (trees, flags, sliding boxes, whatever), why not store the base mesh for each in a ThingMeshType, and refer to that from the Thing type as well:
Type Thing
Field tmt.ThingMeshType
Field level.Level
Field x#
Field y#
Field z#
Field pitch#
Field yaw#
Field roll#
End Type
Type ThingMeshType
Field name$
Field mesh
End Type
The name$ allows you to name each object type so you can move each one appropriately each frame:
Select thisThing.Thing\omt\name$
Case "ball"
...
Case "Crate"
...
Case "Cloud"
...
End Select
This is probably too much information about something you aren't asking about, but what the hell! :-)
|