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.

Code Snippets / make boxes with a click-and-drag interface (in darkbasicpro)

Author
Message
Physics coder
20
Years of Service
User Offline
Joined: 25th May 2004
Location: United States
Posted: 10th Jul 2004 15:12 Edited at: 11th Jul 2004 20:28
this is a snippet creates boxes with a couple clicks.

when you first click on the matrix hold the button down and drag the mouse until it's pointing the way you want it, this positions and rotate the box.

Next click and drag again. this program will use the first point on the matrix as the center of the box, and the point you're dragging as a corner, this scales the box. Finally release the mouse and you have a box!

if you click on a box, it will move the box you clicked on instead of making a new one inside it.

here's the code:
EDIT: scroll down for new verion
you can't change the height of the boxes, as that will not be needed in the game i'm making this for.

when selecting the direction for a box to go in, holding shift limits the direction to every 45 degrees.
when scaling the box, holding shift makes the box a square.

If i bother to put up a second version, it will most likely have SAVE/LOAD commands. I'm using Update 5.3 cause i've heard 5.4 has a slow down when using the intersect object command or something.

-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Jul 2004 17:30 Edited at: 10th Jul 2004 18:22
how do you set the height of the box?

I just whipped this up. The code in the DO-LOOP is mine, the other code(matrix selection) is someone elses. I feel that this interface is easier to use. Doesn't do rotation, just box creation. But it feels more like 3dsmax.



"eureka" - Archimedes
Physics coder
20
Years of Service
User Offline
Joined: 25th May 2004
Location: United States
Posted: 11th Jul 2004 01:44
Quote: "how do you set the height of the box?"


in my first post i said

Quote: "you can't change the height of the boxes, as that will not be needed in the game i'm making this for."


Your snippet is nice.

I'm thinking of adding a feature where once you've made a box, you can click on it, and instead of draging it, you could select an option, drag, rotate, or scale the object.

-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 11th Jul 2004 02:01
Oh, i missed a part of your post then. If its for a specific game design, then do whatever you want.

"eureka" - Archimedes
genius
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: Utah, USA
Posted: 11th Jul 2004 16:53
Awesome!

Why do they have BRAIL on Drive-Up ATM Machines?
Physics coder
20
Years of Service
User Offline
Joined: 25th May 2004
Location: United States
Posted: 11th Jul 2004 20:24 Edited at: 11th Jul 2004 21:17


http://luke.dbspot.com/files/level%20editor.rar

EDIT: I put the http:// thing around the link but it's not making it a hyperlink, just copy it into an adress bar of a new IE window.

EDIT2: extract the rar file into it's own folder.

I've included a level, the dbpro source, and a bmp texture in this 5KB .rar file.

Levels are less than a KB.

controls:

camera movement: W/A/S/D and mouselook.

click and drag on matrix to make a rotate an object
click and drag again to set the size.

When rotating an object, if you press shift you limit the angle to every 45 degrees.

When positioning an object, you can limit the position to every meter by pressing control, or every 5 meters by pressing shift.

When setting the size of an object, you can limit the size to every meter using control, you can force the box to be a square with the shift key.

If you click on an object, it selects it, from there you can position, rotate or set the size of the selected object.

Press tab to show/hide the menu and second camera view

You can save and load levels. If no object is selected, you can see a menu that says ctrl+s for save, ctrl+n for new and ctrl+l for load.

IF you select an object, you can press ctrl+x to delete it, or ctrl+c to copy it.

once you copied it, press ctrl+v+mouse click to paste it where you click your mouse.

the spheres that appear at the corner of each box are way points which will later be used by an A* waypoint pathfinding algorithm.



-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Jul 2004 06:10
looking good. what kinda game is this for?

"eureka" - Archimedes
Physics coder
20
Years of Service
User Offline
Joined: 25th May 2004
Location: United States
Posted: 13th Jul 2004 02:37
Right now it's very, very early in development, even the level editor isn't done, if you want to read about it and see the first screen shot, go to http://luke.dbspot.com/unnamed_tank_game.htm

-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.

Login to post a reply

Server time is: 2024-11-23 20:01:23
Your offset time is: 2024-11-23 20:01:23