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 / need help with shooting function

Author
Message
Crazy Ninja
19
Years of Service
User Offline
Joined: 27th Aug 2005
Location: Awesometon
Posted: 21st Jul 2006 09:17 Edited at: 21st Jul 2006 12:56
I'm working on a sort of like a this space fighter type of game(like the arwing missions in starfox 64). unfortunetly i'm having trouble with the function that creates the missile. heres my code. [edit] took off little # signs


the problem i'm having is is that i can't make an object called missile# even though it equals 2. i tried using val but i didn't really get what it did. if anyone could help me that would be great.
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Jul 2006 10:40
Why do you have #

What's wrong with Missile = 2?

Crazy Ninja
19
Years of Service
User Offline
Joined: 27th Aug 2005
Location: Awesometon
Posted: 21st Jul 2006 12:07
nothing i just put it in sometimes
Krilik
19
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Arizona, USA
Posted: 21st Jul 2006 19:55
The variables you define in your main program can't be used within functions. So what's happening is you define the variable missile in your main program as 2, but in the function you have another variable also called missile, but by default it is defined as 0. You need to either add a parameter to the function like:

request_shot(missile)

Or you can write your function as a sub routine and then return back to your main loop once its finished.

Login to post a reply

Server time is: 2025-05-25 08:38:10
Your offset time is: 2025-05-25 08:38:10