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 / More noob questions

Author
Message
Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 26th Oct 2006 07:52
Hi again, I have been messing around with some stuff just basically experimenting so don't laugh at my dodgy coding

Hope you can see what i'm trying to do here, but it just does'nt do what I was aiming for, any help would be great.



Oh, and is there any reference anywhere to which numbers are refered to by the scancode() function? I can't find the down arrow (I know 207 is wrong). Any online references to DBP functions would also be helpful, the built in index help is not very good.

Regards
§çà®Fãçë™
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 26th Oct 2006 09:02
place this in your main loop at the end for debugging

text 1,1,STR$(scancode())

it will print each scancode as a string through the text command.

Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 26th Oct 2006 09:31
Thanks indi, thqt will come in handy, any chance of help with my initial problem?

Regards
§çà®Fãçë™
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th Oct 2006 13:15
Here's a link to my keystate map (attached to first message):

http://forum.thegamecreators.com/?m=forum_view&t=67436&b=7
Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 26th Oct 2006 13:15
Quote: "place this in your main loop at the end for debugging

text 1,1,STR$(scancode())

it will print each scancode as a string through the text command."


Thanks, that will come in very handy, is there any chance of some help with my initial problem? I don't want anything done for me, I find the best way to learn is to do it yourself, but a push in the right direction often helps.

Regards
§çà®Fãçë™
Coder#05
18
Years of Service
User Offline
Joined: 26th Oct 2005
Location: Denmark
Posted: 26th Oct 2006 16:56
if the problem is that the "bullet" is moveing in the wrong way, its because you are only increaseing the x pos, you need to increase x and z, and in the correct angle. use newxvalue and newzvalue.
Or the problem could be that you cant move while shooting, if so, its because you use a loop to move object 2. just make an variable(shooting = 1) be equal to 1, when the object is created, then in your main loop check to see if shooting = 1, if so call the subroutine that updates the bullets position(but only update the position 1 time per main loop, and set shooting to 0, again when the bullet sould die.

did not test it, and sorry for the bad typeing
hope you understand and that it works

hmm


easy comes easy goes
Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 26th Oct 2006 17:19
if the problem is that the "bullet" is moveing in the wrong way, its because you are only increaseing the x pos, you need to increase x and z, and in the correct angle. use newxvalue and newzvalue.
Quote: "Or the problem could be that you cant move while shooting, if so, its because you use a loop to move object 2. just make an variable(shooting = 1) be equal to 1, when the object is created, then in your main loop check to see if shooting = 1, if so call the subroutine that updates the bullets position(but only update the position 1 time per main loop, and set shooting to 0, again when the bullet sould die.

did not test it, and sorry for the bad typeing
hope you understand and that it works

hmm "


Ok I understand that no problem, how would I parse an integer variable to a function then return it back again, in c++ thats an easy task of creating a custom integer returning function with a (parameter) for the variable, whats the DBP equivalant?

Regards
§çà®Fãçë™
Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 26th Oct 2006 18:01
Coder#05, on your advice I came up with this, problem is I don't know how to pass a variable from the Shoot function back to the main loop so that I can reset nShoot back to 0 once the right condition is met.



All that happens atm is the game crashes when you attempt to shoot and tells me the object does not exist on this line:



It's driving me nuts, especially since my posts are only going out an average of every 6 hours, it's taking me a day just to get one answer to a problem, I know that this is neccesary, but I just wanted to vent my stress

Regards
§çà®Fãçë™
Coder#05
18
Years of Service
User Offline
Joined: 26th Oct 2005
Location: Denmark
Posted: 26th Oct 2006 19:26
Hey..
You are actually all ready resetting variable nshoot back to 0 here:

I think your error is here:

the 1 is supposed to be 2 ?
I think thats it.


easy comes easy goes
Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 26th Oct 2006 19:30
Oh, so variables are effected globaly no matter where they are changed (i.e. within a function) ?

Regards
§çà®Fãçë™
Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 26th Oct 2006 19:40
Right, now we are getting somewhere lol, it does'nt crash anymore but some strange stuff happens, the original cube (object 1) disappears when you hit space (I don't wish it to disappear), and instead of the bullet cube coming from the direction of the original cube, it comes from a totally different direction and goes off at an angle.....



Regards
§çà®Fãçë™
Coder#05
18
Years of Service
User Offline
Joined: 26th Oct 2005
Location: Denmark
Posted: 26th Oct 2006 21:00
no i think variables not set to be either local or global before (in this case) the main loop(or any where else in the program, exept for in functions) are local, but work in all sub routines, for an variable to hold the same value in a function, it needs to be initialized like this
GLOBAL varname as data_type

For your angle problem, look in to the newxvalue and newzvalue commands.

Hope i spelled okay he..



easy comes easy goes
Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 26th Oct 2006 22:06
I give up on this it's taking far too much of my time and I am hardly moving forward.....

Any suggestions on what I should experiment with to help me learn DBP?

I was aiming to create a simple side scrolling shooter but someone told me to start off with 3d, I have no idea where to start it's all new to me, I understand the logic but I just don't know how to use most of the functions because theres not much documentation on them (that I can find).

Regards
§çà®Fãçë™
Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 26th Oct 2006 22:28
Actually nevermind, I have posted in the DBP forums instead, thanks for all of your help.

Regards
§çà®Fãçë™

Login to post a reply

Server time is: 2024-09-25 11:34:28
Your offset time is: 2024-09-25 11:34:28