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 / Need bullets ! ! !

Author
Message
Matija the n00b
14
Years of Service
User Offline
Joined: 2nd Aug 2010
Location: Croatia
Posted: 29th Aug 2010 13:24
Hello everyone!

Yesterday, I started to work on this game.
For now, there is only one enemy and no bullets.
But when the game is finished, there is going to be a lots of enemies(ghosts) that are going to chase the player and try to kill
him.

Now, my game has textures, but in this code, I deleted them so you could run it and help me


So I tried to make bullets myself and also searched the forums but I didn't get the answer I wanted.
The bullets should be visible(like spheres).

Every help would mean allot to me.
THANKS in advance !
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th Aug 2010 00:20
I didn't see where you had put in for the bullets. Anyway, this code makes a sphere where the player is when the LMB is clicked. The bullet can collide with the enemy. The enemy object is simply hidden and is not repositioned.

I used the same coordinates as you did for checking the boundaries for the bullet, but doing it this way seems very limiting. You're not always going to have this exact same size of room. I would suggest allowing the bullet to move a certain amount of times before it dies. With regard to the player, you could check collision against the outer walls instead of physical X and Z coordinates.



So many games to code.......so little time.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 30th Aug 2010 01:09 Edited at: 30th Aug 2010 01:10
I posted a different snippet in this thread:
http://forum.thegamecreators.com/?m=forum_view&t=152543&b=1

If you want multiple bullets though you'll want to look into arrays.


Guns, cinematics, stealth, items and more!
Matija the n00b
14
Years of Service
User Offline
Joined: 2nd Aug 2010
Location: Croatia
Posted: 30th Aug 2010 11:00
Hey thanks LBFN, this works as a charm and is exactly what I needed.

I know the way I did things in this game aren't perfect but hey, I'm
still just a noob.

But there is something in your code that i didn't understand.
When I shoot the bullet and bullet is in the air, then if I press the
"A" key, the bullet disappears. I simply deleted that line so now the code is great.

Sixty Squares, I appreciate your help but I already got the answer to what I needed.

Thanks !
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th Aug 2010 17:09
You're welcome.

Quote: "But there is something in your code that i didn't understand.
When I shoot the bullet and bullet is in the air, then if I press the
"A" key, the bullet disappears. I simply deleted that line so now the code is great."


Doh!!
I put that in for testing purposes and forgot to take it out before I posted it.

Good luck with the game.

So many games to code.......so little time.

Login to post a reply

Server time is: 2024-11-24 12:00:02
Your offset time is: 2024-11-24 12:00:02