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 / Issues While Trying to Shoot Bullets

Author
Message
xSpadez
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location: 127.0.0.1
Posted: 17th Apr 2012 05:53 Edited at: 17th Apr 2012 06:01
Hello again,

I'm still learning basic functions in DBP and I started thinking about making an actual game. So to start small I'm just focusing on player movement and shooting. I already hit a snag

I can shoot bullets simply with adding to the y pos and drawing it to screen but then I thought "when the player moves, the bullet x y start pos needs to be where the player is.." So I made a TYPE BulletType and put in basic fields. Now with the same code when I press spacebar the game freezes completely.... - Nevermind I just fixed the code to work... Well now I feel 2x stupid than before x)

Thanks,

xSpadez

xSpadez - Like a baws
Ramon156
13
Years of Service
User Offline
Joined: 13th Jul 2011
Location: Netherlands
Posted: 17th Apr 2012 15:25
Hi xSpadez. Even though you fixed your code I'd like to know what you did wrong.
My guess that it is a 2D game.
Did you forget to update new bullet X Y positions so it spawns at the player, or did you forget putting this into the loop so it updates the positions?

I have learned in 3D programming it's "better" to use a raycast rather than an using object as bullets, as they can skip a frame and miss the target.

Would this also be the case in 2D?
xSpadez
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location: 127.0.0.1
Posted: 17th Apr 2012 20:22
I simply forgot to put SYNC at the end....

For shooting I did an IF spacekey AND shoot var then it would do a repeat until bullet.y was outside the screen. I forgot to put SYNC at the end for it to redraw.

xSpadez - Like a baws

Login to post a reply

Server time is: 2024-11-22 00:32:12
Your offset time is: 2024-11-22 00:32:12