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 / i need help and fast!!

Author
Message
i need help!!!!Quick!!!!
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 18th Sep 2008 00:15
ok so im taking this class at school and we arent learning justa whole bunch.we are using just regular dark basic.we are making this video game thats suppose to help advertise for a company(not really its just a scheme to go along with)and they've already premade a game thats boring but we have to tweak it.so i have a few questions about somethings. i would appreciate it if some one helped me out. my first question ishow to make a room bigger? its really small and there are 4 values i guess u call them(ex.0,0,0,0)
im not sure which value changes my lenth and width.my second question is wheni make a terrain how would i load as my floor.
it says
make object box (and then something else)
would i just replace the box with the terrain?or should i make it into a variable?
and my third and final question is i want to put turrets at each corner of the room and have it randomly shoot at the ground by my object how would that code look?
it would be great if someone could post that code or tell me how to make them randomly fire!!! thank you so much!!!
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 18th Sep 2008 01:30
Quote: "ishow to make a room bigger"

Depends. It appears that you are using 3d, so are you using a 3d model or are you using a 3d object (models are made outside of darkbasic, while objects are using commands)?

If you use a model, you can use the scale object command. If it is an object, you can just change the command values themselves.

So, make object box 1,5,3,6 would make an object (object number one) that is a box that is 5 units wide, 3 units high, and 6 units deep.

Quote: "wheni make a terrain how would i load as my floor."

DarkBasic doesn't support terrain, only pro. Now if you mean terrain in general (as in just a term for ground) you can use a box if you want. The best way would be to use a 3d modeling program and make a landscape. If it should be a flat ground, then just use a box, it can stick out past the walls if necessary.

Quote: "third and final question is i want to put turrets at each corner of the room and have it randomly shoot at the ground by my object how would that code look"


Alright, I don't have any code to give you but I will walk you through the pseudo code.

-Each turret must be loaded/made individually and placed (if made in the program you can use a for-next loop to make multiple objects with minimal lines of code).

-Place each turret using the position object code. You can set them to an initial orientation using the point object command.

-Assuming that all of the turrets are the same, you will need a couple variables. One for the max speed that it can turn on the y axis (left and right), one for the max pitch, and one for the rate of fire. You will also need a counting variable to use to time the turrets correctly.

From here on out I will simply refer to a single turret for simplicity.

-Determine if the turret will need to turn left or right. There are several methods, but I kinda prefer the trig way. You calculate the angle between the player and the turret (remember, theta=arctan((y2-y1)/(x2-x1)) ). Then add/subtract the turrets current orientation and the angle between the turret and the player (I say add/subtract because I am not sure which to use, just guess and check).

-Next you will need to determine if the angle is greater than or less than the max turning speed. If it is greater, then simply use TURN OBJECT RIGHT or TURN OBJECT LEFT by the max speed. If it is less than that, turn it the difference

-If if the angle is zero, you will know that the turret is pointing directly at the player (you can add in code to control the pitch, but that is only important if the player will be jumping). Then you will increase your counting variable for the rate of fire. Then check to see if it equals your rate of fire control variable (remember, you need 2 for here). If it is greater than or equal to it (using it to stop bugs, though simply checking to see if it is equal to should be fine), fire and set the counting variable to 0.


Tip: Rather than using 4 counting variables, you can use an array if you know how. Also, put the code into a for next loop to be executed 4 times in the loop, once for each turret.

Hope this helps.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
i need help!!!!Quick!!!!
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 20th Sep 2008 00:48
holy crap dude you are like jesus right now.haha. i did find a way to load the 3d terrain in the floor, you have to have it saved like an .X file. im going to have to make the gravity stuff for it though.im going to try to enlarge the room on monday.so ill let you know how that works out. i think the turret thing might be out of hand for me but ill try or see if some one could do a little bit of the code, because im a noob ill try and have someone do a little coding cuz i cant do all of it but i can do alot.but thank you so much!!!!

Login to post a reply

Server time is: 2025-06-07 06:44:30
Your offset time is: 2025-06-07 06:44:30