Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Making Levels

Author
Message
gopherbro 94
16
Years of Service
User Offline
Joined: 21st Dec 2008
Location:
Posted: 29th May 2009 03:25
I need to make three quick levels in this game, In my class I have to make the levels but I dont know how!! Please help me!! All I need to do is change some of the wall positions, textures and number of enemies.

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 29th May 2009 04:42 Edited at: 29th May 2009 05:03
That code is a mess. Countless do loops, poor structure and the only remarks are one word long which is totally unhelpful.
How are you supposed to learn from that?

I'll have a read and see if I can help you.

[edit]
Just as advice, this is the wrong type of loop

A do loop is an unconditional loop; it will reiterate (loop) no matter what, until you force an exit.
GOTO is outdated, it's far easier to follow your code if it executes subs and functions from a main loop rather than jumping all over the place.
if Keystate(scancode()) =1 is inefficient, you are using two commands to do one job. If scancode() >0 is better.

What you want is a conditional loop; one that will exit when a condition is met.

This loop doesn't seem to do anything but delay the program.
You could just use wait key.

There is an eight letter word. You can insert a letter into it or remove a letter from it without changing its meaning. Answer
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 29th May 2009 05:11
I could probably get that down to 60 lines or so by the looks of it but I'm not on a PC and I need to work on my own project.
Sorry, hope I helped a bit anyway.

Someone else will be here soon, it's the TCG forums

There is an eight letter word. You can insert a letter into it or remove a letter from it without changing its meaning. Answer
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 29th May 2009 05:16
Quote: "I need to make three quick levels in this game, In my class I have to make the levels but I dont know how!! Please help me!! All I need to do is change some of the wall positions, textures and number of enemies."


Looks like the commands you want will be:
POSITION OBJECT
ROTATE OBJECT/TURN OBJECT RIGHT/TURN OBJECT LEFT/PITCH OBJECT UP/PITCH OBJECT DOWN
LOAD IMAGE
TEXTURE OBJECT
and of course:
FOR-NEXT for spawning the enemies (even then though there is probably a better way where you just check to see if the enemy number is less than the largest possible).


Your best bet would be to model them externally and then just load them but idk if you can do that.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 30th May 2009 09:49
@gopherbro 94
If you are supposed to stay within the design parameters of this program, it looks the levels are altered with these two functions:


For LoadLevelMap() instead of having all of those values hard coded inside the function, what about creating an array, or data statements, or a file that you read into the function?

So for example, let's say you create an array that holds all of the values that will eventually be passed to LoadObstacle through LoadLevelMap

There are 14 calls to the function LoadObstacle7 in LoadLevelMap() and 7 parameters in the function LoadObstacle:
dim obdata(14,7)
dim obname$(14)

Inside LoadLevelMap() you must reference the array you are creating and again assign everything as it was - this time by looping through the values stored in the array:



Before calling the altered function, you must READ DATA into the arrays obdata() and obname$(). You can change each level by reading new data into the array and calling the LoadLevelMap() function.

Any of the other functions you could approach similarly.

Enjoy your day.

Login to post a reply

Server time is: 2025-05-17 06:22:19
Your offset time is: 2025-05-17 06:22:19