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 / What wrong in my code?

Author
Message
Seboolek
17
Years of Service
User Offline
Joined: 2nd Oct 2007
Location: POLAND
Posted: 24th Dec 2007 13:32
I make a zombie game but i have a bullet problem I still have it... I try but i dont know how to make a wrong...

That is my code game.

Ctrl is shoot. Pistol is a "1".

Attachments

Login to view attachments
Veron
18
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 24th Dec 2007 14:37
"Bullet problem" isn't exactly descriptive enough for any of us to help you. What exactly is wrong with the bullet?


Seboolek
17
Years of Service
User Offline
Joined: 2nd Oct 2007
Location: POLAND
Posted: 24th Dec 2007 14:58
I try to make a shooting. I click a CTRL then make bullet but when click again then this same bullet has destroy and make a start position. I wanna to make a "Machine gun" effect. How to make? in my code no work shooting.
HeavyAmp
18
Years of Service
User Offline
Joined: 25th Oct 2006
Location: Castle in the Sky!
Posted: 25th Dec 2007 04:28
you want to make multiple bullets for your gun instead of using the same bullet over and over?

You could either make an array of bullets and give them a life time. Or you could just have a shooting effect then do a raycast to detect if you have hit anything.

Better to be dead, than to live your life afraid.
MR FAN
16
Years of Service
User Offline
Joined: 2nd Dec 2007
Location:
Posted: 25th Dec 2007 09:01
hmm, would this help, a little bit?

this is just part of a much bigger program that I wrote, so there might be things missing, so you will have to figute some stuff out on your own.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 26th Dec 2007 05:39 Edited at: 26th Dec 2007 05:41
In my entry for the Christmas Minimal Media compo, I just have a set of numbers that are designated for the bullets (say, 200 to 250). Then I use code like this:



Though you should probably check into raycasting rather than making objects and moving them.
This code works for me because my "bullets" are actually presents, and they are meant to seem "thrown" not "shot," so they move rather slowly. If you have real bullets, they are going to move quite fast, and this can cause problems with collision.

Say your bullets were moving at 10 units every loop, and there was a wall 5 units thick. The bullets are liable to move right through it and keep going:



Anyway, long story short, raycasting is faster and better


"Ok, so that wasn't funny. I don' have any good Christmas jokes."
Seboolek
17
Years of Service
User Offline
Joined: 2nd Oct 2007
Location: POLAND
Posted: 27th Dec 2007 12:16
Thanks all.
I create this but i don't know why to not run.

Bmaczero: that is great. I add this on my code but not work.. look that.. maybe you know how is wrong.




All media in first post.

Login to post a reply

Server time is: 2024-11-26 05:25:49
Your offset time is: 2024-11-26 05:25:49