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 / So i've completed ScouseKnights Pacman tutorial...

Author
Message
Aramyth
15
Years of Service
User Offline
Joined: 13th Oct 2008
Location:
Posted: 19th Jan 2009 02:35 Edited at: 19th Jan 2009 06:54
So, for anyone who's ever done this, any ideas how to change it so I can implement new functions, like letting my character shoot at the ghosts?

If anyone could just tell me where to begin that would be ace.

Dragon Knight
17
Years of Service
User Offline
Joined: 10th Jan 2007
Location: Newcastle
Posted: 19th Jan 2009 08:40 Edited at: 19th Jan 2009 08:42
I'm really tired so forgive me if it doesn't help heh... but i'm going to have a stab at it:

Waw... the first person I've seen in a while which actually indents code, along with commenting, i applaud you heh, apart from the use of global variables.

Ahm where to start, first of all make a function named HandleGun

next code each of these parts:
ShootingState `Is the user currently shooting or not

If Shooting AND there is a free bullet
make the bullet
timer til next shot is available
Also record here the direction of the bullet in an array
inc bullets life to 2000 (or what ever you like )

NEXT function to handle Bullets
using the array and a for loop move the bullets forward and decrease each bullets life
once the life is <0 kill bullet and reset bullet life to 0
(resets to 0 to check if the bullet is not in use, Shooting function)
Handle collisions of bullets hitting ghosts

Next Function
Make the ghosts die blah blah.. you probably know the rest




I'm not quite sure what part your having trouble with though.
So here's some random information:
Are you looking for collision detection?
Go Sparky's dll absolutely amazing. or write your own little easy bit of code. E.g. a box around the ghost what are the co-ordinates etc.. of this box. Is the bullet within this box etc..

Are you looking for bullet generating?
Simply make a function when shooting make the bullet and move it in which ever direction you desire.

Are you looking for gun animation?
Make a small object infront of your gun ghost it and texture it with a spark or a gun splater type effect.

----------------------------------
http://www.hybridwolves.co.uk
----------------------------------
Tom0001
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location:
Posted: 19th Jan 2009 11:22 Edited at: 19th Jan 2009 11:23
Also, just on a note, I read a tutorial on making an FPS once before that used an interesting system for collision detection.

It didn't make bullets, however, to my disappointment, as it claimed them to be too fast. However, it created a limb for the player object and then offset the limb so it would be ahead of the player and hidden. Then, if a mouseclick was detected, a gun was held and selected and there was a free bullet, it would begin lowering the enemy's health variable, appearing to shoot the enemy.

However, for this, I assume that it's 2D and you're using sprites. So, creating the bullet in this 2D layout would definitely be better than the above method. For the collision detection, you may want to use 'SPRITE HIT' or 'SPRITE COLLISION', although for some reason 'SPRITE HIT' seems to work where 'SPRITE COLLISION' does not, for me. Odd.

Login to post a reply

Server time is: 2024-09-28 00:17:51
Your offset time is: 2024-09-28 00:17:51