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 / Making an fps game. Need Help!!!

Author
Message
Swapfox98
20
Years of Service
User Offline
Joined: 7th Apr 2004
Location:
Posted: 7th Aug 2004 01:17
How can I make my camera pick up ammo,shoot it, and print how much I have left? Look at my code and tell me what i need to do.

I also can't get my matrix to look the way I want. Need help with that to.
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 7th Aug 2004 09:32
Hi!

Well, let's start with something I noticed you asked about in the other thread, namely that your ammo isn't changing properly.

First off, the manner you are detecting if the camera is on top of an object is very slow, when it would be faster to use an if statement.

not;


But;


And second, I notice that you have not made ammo a global value, so it cannot be changed in the function itself as far as the rest of the program is concenred. To do that in DBPro use the ilne of;

GLOBAL AMMO

Up near the top of the program, or in DBC make the value into an array as in;

DIM AMMO(0)

Which does the same thing. Alternatively, you could have the function return the new value of ammo, as in the above code with the ending line of;

endfunction ammo

Then your routine in the main loop would be;

ammo=ammo+check_ammo()

All fine ways of getting there...

Now I'm tired, I'll look at the rest later or let someone else pick up the ball.
Good Luck,
S.

Any truly great code should be indisguishable from magic.
Swapfox98
20
Years of Service
User Offline
Joined: 7th Apr 2004
Location:
Posted: 7th Aug 2004 23:07
Thanks but my program is stil running to slow. My system suports 1000mhz,a display mode of 1024,768,32,and I hive a Nvidia Geforce2 vidio card.Is it my program thats making it run slow?
Swapfox98
20
Years of Service
User Offline
Joined: 7th Apr 2004
Location:
Posted: 7th Aug 2004 23:30
Sorry but there's another problem. my bullets won't move!
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 8th Aug 2004 00:45
Uh....

I might be crazy here but my book says that TIMER() is a function that returns the value of the CPU time, yet you have the following code;

inc timer(), 1

You can't do that. So when you're testing;

If timer()<1000

there's an invalid value there....

Second, you start at the top of the program saying SHOOT=1603 yet, the moment you fire a bullet you say;

inc shoot,1

which makes the value 1604. Since you only defined 1603 objects, there's nothing to move given the line of;

if object exist(shoot) .... it doesn't!

And I don't see any place where you decrement the value of shoot, so it only gets bigger. Even that would be fine if you defined new objects to be your bullets, (up until the compiler limit was reached) but you don't do that.

Overall, I think the objects and their numbers are confusing you...
S.

Any truly great code should be indisguishable from magic.

Login to post a reply

Server time is: 2024-09-22 20:26:53
Your offset time is: 2024-09-22 20:26:53