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 / How to make an object fall to the ground

Author
Message
madmax700
20
Years of Service
User Offline
Joined: 21st Mar 2005
Location:
Posted: 8th Apr 2005 12:38
If anyone can help me. I need an example of how to make an object fall to the ground with out using object position y() command. My object is glued to another object and carried around, but when I use unglue object to drop it, I want it to fall to the ground. I was using object position y() command to get position after unglueing and repositioning object to ground level, but it severely slowed down my game. Thanks this is the code I was using. Does anyone know of any alternatives, if so please help.
HWT
20
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 8th Apr 2005 23:19
Hi there

I've tried clicking on your link to your Source Code, but an error popped up (probably a network error).

Anyway, here is my take on your situation. Instead of GLUE OBJECT commands, I've used POSITION OBJECT commands instead. I think you'll find the latter to be more effective.

Pseudo-Language (common language) Definition
STEP 1: Make the world and the objects (player and carry object)
STEP 2: Allow player object movement
STEP 3: Position carry object (maybe a few steps to the right)
STEP 4: If command is given to drop object, then release the carry object and make it fall to the ground.
STEP 5: If the object reaches floor, stop it from moving

DBC Language
Here is a demo code showing how to do the above. I assume you have some prior knowledge with NEWXVALUE and related commands. Note, however, that this was created with a 'plane dropping bomb' picture in mind, but the concept is still rather the same:



If you didn't understand something, please don't hesitate to ask

HelloWorld Tommorrow
madmax700
20
Years of Service
User Offline
Joined: 21st Mar 2005
Location:
Posted: 9th Apr 2005 01:33
Thanks, my code is a lot like that, but I get a performance hit when I use it.

Here are 2 examples of my game so far you can see the difference in speed.

http://www.uswa6285.com/haulagetruckmania6.EXE - no objects (faster

http://www.uswa6285.com/haulagetruckmania7.EXE - if you park under the shovel can use "t" to trip the bucket and "s" and "d" to control the boom. Object falls into truck, but game gets alot slower.

other than the objects bacially same code. Mabey I'll have to suffer the performance hit ? Anyway this is my first game so please don't be too critical if you check it out
HWT
20
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 9th Apr 2005 02:16 Edited at: 9th Apr 2005 06:00
I'll check them out now I'll reply back into this same post a little later.

If your performance is hit try changing display modes using SET DISPLAY MODE command or the SET CAMERA VIEW command - these help me alot when my performance is low.

EDIT: Hi again

Kind Note: the first EXE didn't work (haulagetruckmania6.EXE) but the second one did .

I reviewed your project thoroughly and it's pretty impressive even at this stage Keep up the good work

Would it be possible to have a look at your source code? I give you my word that I won't disclose ANY of the code to anyone or give it to anyone else. I need to see it because I think your performance maybe being hit by too many lines of code that could be effectively shortened.

Performance can be improved by using those SET DISPLAY MODE and SET CAMERA VIEW commands. As you may know, the first command sets the screen resolution for the computer. This is highly effective in performance improvement. Equally effective is the second command which basically sets the size of the screen (many games allow this like Wolf 3D). I attached some code which shows how improvement can be improved using these commands.

You should also have a look at the DBC tutorials namely:
(i) Examples/Screen/exam01.dba
(ii) Examples/Camera3D/exam08.dba
(iii) Examples/Camera3D/exam06.dba

Hope this helps

HelloWorld Tommorrow

Login to post a reply

Server time is: 2025-05-23 15:35:57
Your offset time is: 2025-05-23 15:35:57