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 / Converting a sub to a function. help

Author
Message
Nul error
19
Years of Service
User Offline
Joined: 12th Aug 2005
Location:
Posted: 25th Jan 2006 08:40 Edited at: 25th Jan 2006 08:57
I finaly have the bullet code working well in sub in the game in making but I want to see I can make it to a function to see if it would be better and plus eliminate some reduncant coding.

this is for dbpro



But somehow its just does nothing. Is there something I forgot?
Gyrich
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: Here, obviously.
Posted: 25th Jan 2006 21:17
I can try to help, but i think it would encourage more people to respond to your answer if you posted your entire code for the game so we can see not only the function, but how the function is being called and used in your code.

DBPro User
PC: WinXP, AthlonXP 2100+ 1.7ghz, 80gb HD, Nvidia GeForce FX 5200 (128mb onboard RAM), 512mb DDR400 system RAM. Thank you for your help.
Underworld 1020
20
Years of Service
User Offline
Joined: 2nd Mar 2004
Location: NY, USA
Posted: 25th Jan 2006 22:14
If these:

HPplacement(
Fired(
Life(

are arrays, then you need to make them either "global" or create them inside the function. The reason is because each function is like a seperate piece of code and they are not connected. And everything inside the function like varibles, arrays, and so on, are only temporary. So basically the function can't read the arrays that you use outside of the function unless you make them "global" when you create them. Or you could just create them inside the function, but then they would only exist inside the function...I think I just made that really confussing when its not suspossed to be, but anyways I think it has to do with the arrays.

Nul error
19
Years of Service
User Offline
Joined: 12th Aug 2005
Location:
Posted: 25th Jan 2006 22:40 Edited at: 25th Jan 2006 23:08
@ Gyrich That would be something I don't want to do and plus my game weighs in at 2000 lines at the moment.

@ Underworld 1020 Ill try to do that on the last 2 functions. HPplacement function you can pretty much ignore its just the place where to point where to start and its pretty much disabled to center of the player till I get it fixed.

edit: Using globals worked plus disabling main_int# helped. now need to figure out how to make main_int# increase up so it won't just fire tons of bullets that it lags my screen.
Gyrich
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: Here, obviously.
Posted: 26th Jan 2006 04:07
well regarding increasing main_int#, you can add a second flag to the "inc" command (in dbpro at least, i use dbpro) and control how much the value increases, i.e.:



will increase FakeVariable by 5, and



will increase it by .1. Hope that can shed even a little light on a solution to ur problem. Have a good one.

DBPro User
PC: WinXP, AthlonXP 2100+ 1.7ghz, 80gb HD, Nvidia GeForce FX 5200 (128mb onboard RAM), 512mb DDR400 system RAM. Thank you for your help.
Nul error
19
Years of Service
User Offline
Joined: 12th Aug 2005
Location:
Posted: 26th Jan 2006 04:41
Increasing it up by just 1 is enough for me. Ill be dropping that system to a time based one when I learn more about learning how to do that to vector based movement.

Login to post a reply

Server time is: 2024-11-27 05:34:23
Your offset time is: 2024-11-27 05:34:23