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.

Newcomers DBPro Corner / 3d level creation in sidescrollers

Author
Message
Tucker
14
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 21st Oct 2010 04:47
Hey guys,
What are the best ways to go about creating a 2d level using 3d objects?
I have used a data array before, but it was quite confusing after a while.
By best way, I mean, easiest to edit, change, and add objects.

Cheers

Bow Chika Bow Wow
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 21st Oct 2010 16:01 Edited at: 21st Oct 2010 16:04
There are two ways of doing so. The first is exact, using sparky's collision commands to collide on a custom made level from a modelling program. The second, and probably easier way, is using a grid system.

Let's say you want to make a 10x10 level. Initialize your grid with a 10x10 array:



Note that 0 is also an index.


Next step is adding your level data into this array. How about we have 3 different bricks? we'll make one stone, one dirt, and the last one cheese. Why cheese? I like cheese :3 So define that before you start creating your level:



Alright, now let's create the level. You can either make it manually, or code a simple level editor to do this process for you. For now we do it manually.

Level:



OK, so we first set the ground:



Next the big wall, positioned at 4,0:



And last, the little wall:



Alright, now we make some cheese and some dirt in the sky (don't ask me why )




And now you have a 2D grid level saved into just one array. To load the level from the array, you can use this:



And that's it! For collision I recommend looking up on sliding collision, since they are only simple cubes.

TheComet

Tucker
14
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 23rd Oct 2010 03:19
Hey The Comet,
Thanks for the info, I am using a data array to make a grid type setup, I find it easier to see what im doing and better to put stuff in and take it out etc.
At the moment im using collision box's for the level objects and the player. Is this the best way to go about collision? It seems to look alright and is very smooth and responsive.
I am also having two characters, both being controlled by the player, but only one at a time.
Is using limbs a good way to have two objects tethered together? and can you switch controls between the main object, and the limb allowing the limb to be controlled instead of the player object?
Thanks for your help!

Bow Chika Bow Wow
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Oct 2010 18:55
Quote: "At the moment im using collision box's for the level objects and the player. Is this the best way to go about collision? It seems to look alright and is very smooth and responsive. "


You already answered your own question before I could

Yep, collision boxes are perfect for grid-based levels.

Quote: "Is using limbs a good way to have two objects tethered together? and can you switch controls between the main object, and the limb allowing the limb to be controlled instead of the player object?"


So you have 2 player objects, and both are connected together, one the main object, and the other the limb of the main object? I'm not sure if that is what you want to be doing, because when you move the main object, the limb will move with the main object, where if you move the limb object, the main object will stay where it is.

Better to keep them apart as two separate objects

However, you will be able to move the main object with the following code:



And you will be able to move the limb object with the following code:



Quote: "Thanks for your help!"


Glad to help!

TheComet

Tucker
14
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 24th Oct 2010 11:19
Well i want the second object to follow the player when its not being directly controlled, and so far the limb does that, it tails the main object, but im going to make the controls switch between the two characters for a puzzle based type of play. (jump on the other player to get to tall ledges or across gaps etc)

So should I be using a limb, or code in another object which follows the player object until the controls swap is initiated?
I'm not even sure I'll be able to do that.
Is there an easy way of making another object gravitate around the mainobject without setting up its positioning in space?

Bow Chika Bow Wow

Login to post a reply

Server time is: 2024-09-28 22:24:33
Your offset time is: 2024-09-28 22:24:33