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 / problem with shooter

Author
Message
White Fang 12
17
Years of Service
User Offline
Joined: 28th Aug 2007
Location: In my office coding
Posted: 6th Mar 2008 23:08 Edited at: 6th Mar 2008 23:46
What im trying to do is make a side scrolling shooter but i can't get my box to move and shoot at the same time when ever i shoot my box stops moving and i have to wait untill the shoot animation is done heres my code please help

I just noticed my shooting code doesn't even work right

I'm a noob help will be accepted
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 7th Mar 2008 03:11 Edited at: 7th Mar 2008 03:15
For whatever reason, the correct Y coordinate of your shot is not being returned (maybe using 'move object' has something to do with it). Some comments:
1. You have coded it so that you have to wait for the shot to get all of the way across the screen before you can move; not a good idea. Your code should allow things to keep moving during each loop.
2. What's with using camera 1? Why not just use camera 0 (default)? With your code, you actually have both cameras working. If you move up toward the top it shows object #1 in two places.
3. Sync rate 0 is good when you want to know how fast something will run or to make comparisons. You should choose a sync rate that will keep the game pace at a reasonably close constant. Otherwise it will fly on the best machines and drag on the slow ones. It depends on the game as to what that is. Normally I code in the 40 - 60 FPS range.

I have revamped your code to give you something to work with. Here it is:



You should be able to add multiple missiles fairly easily.

You will need to either set the screen width and height or will have to look at the height to determine the upper lower limits for object #1. With my current screen rez, 96.0/-96.0 worked, but this will not always be the case.

Best of luck,

LB
White Fang 12
17
Years of Service
User Offline
Joined: 28th Aug 2007
Location: In my office coding
Posted: 7th Mar 2008 14:40
Thanks, That helped me a lot, and i understand the code too since object 1 starts as 0.0,0.0,0.0 and the mx#,my#,and mz# start 0.0 and when you move the box it in incs by to moving the box and positioning the missle. once again thanks!

I'm a noob help will be accepted
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 8th Mar 2008 00:07
Glad to help.

Good luck with your game.

LBFN

Login to post a reply

Server time is: 2024-09-27 12:17:37
Your offset time is: 2024-09-27 12:17:37