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.

Author
Message
Delta 7
15
Years of Service
User Offline
Joined: 27th Jan 2011
Location: somewhere
Posted: 27th Jan 2011 14:52
OK, ive been tring to put together this zombie game that ive been working on but so far ive run into one problem: i cant make the shooter part. I can make a 2d shooter but not a 3d one so can some one help

(\_/)
(0.0)
(> < Bunneth
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 27th Jan 2011 17:10
This isn't the best coded project I've ever done but you can get the gist of using raycasting for bullets etc.

http://forum.thegamecreators.com/?m=forum_view&t=180856&b=1

You can use whatever you want from that.

Mainly look at the raycasting bit, it might look a little complicated because I've included a bit of code to do the weapon's accuracy. One thing I would change about that project is I would save each bullet's vector to a UDT array instead of calculating the vector every frame, just to help the FPS.

Hope it helps,
Broken_Code
Delta 7
15
Years of Service
User Offline
Joined: 27th Jan 2011
Location: somewhere
Posted: 27th Jan 2011 19:10
lol, thanks for the tips. I had downlaoded the code/projet before looking for help but had no idea what i was looking for.
Thanks,
Delta 7

(\_/)
(0.0)
(> < Bunneth
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 27th Jan 2011 23:51
Yeah, it looks a little daunting at first, I've taken out the bit relevant to shooting and stripped all the online related stuff from it, also I've added a lot of annotation.



You will also need code to handle your bullets (again stripped down and annotated):



I hope this helps,
Broken_Code
Delta 7
15
Years of Service
User Offline
Joined: 27th Jan 2011
Location: somewhere
Posted: 28th Jan 2011 00:52
Thanks alot ive finally managed to get the shooting working thanks to this.Now i can move on to the easier stuff like menus and A.I's for the zombies, lol that should be simple considering all they do is run towards you
Thanks again,
Delta 7

(\_/)
(0.0)
(> < Bunneth
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 28th Jan 2011 16:10
That's cool. I should have posted this code from my current project:



It's much easier to read and is far more efficient than the older code. If you're having trouble with the accuracy take a look at vector maths. I hope it can help someone.

Thanks,
Broken_Code
seppgirty
FPSC Developer
17
Years of Service
User Offline
Joined: 3rd Jul 2009
Location: pittsburgh, pa.
Posted: 29th Jan 2011 17:13
bookmarking this thread now thanks broken-code.

gamer, lover, filmmaker

Login to post a reply

Server time is: 2026-07-16 12:20:01
Your offset time is: 2026-07-16 12:20:01