|
-
[F8] Shooting game bullet questions
I am making a 2d eagle-eyed view shooting game that uses space to shoot. (The bullet is a long straight line)
I have a few simple questions I hope someone could answer for me:
1. How do I add a 'reload' effect so that someone playing the game can't just hold down space for a rapid fire?
2. How do I make the bullet stop at one person in a situation like this:
----- --- but not having it go through the 1st guy.
-
-
1. how are you using the space are you saying onPress, or onKeyDown ?
for number 2,
just use a hitTest, if (yourBullet.hitTest Target){
badGuy.removeMovieClip
}
something to that effect
-
1. onkeydown
2. that would remove the whole bullet
-
Modulator
1. I usually make a blank MC and use it as a controller as something like this:
Code:
onClipEvent(enterFrame){
if(Key.isDown(Key.SPACE)){ //Or whatever key you're using
if(shotCount <= clipSize){
_root.attachMovie("mc.bullet", "bullet"+shotCount, shotCount+buffer);//Whatever you've
SHOOT SHOOT SHOOT SHOOT;//done to make it
SHOOT SHOOT SHOOT SHOOT;//shoot. It doesn't
SHOOT SHOOT SHOOT SHOOT;//have to look like this.
shotCount++;
} else {
reload == true
}
}
}
if(reload == true){
if(reloadComplete == reloadTIME){//Are we finished reloading?
shotCount=0;//reset
reload = false;//we finished reloading
} else {
reloadComplete ++;//still reloading
}
}
I find the problem with onKeyDown is that it sometimes goes funky chicken compared to the frame rate. With onClipEvent(enterFrame), the whole process is covered once per frame.
2. Just remove the movieclip
Last edited by Katnap Kaos; 02-19-2007 at 03:56 AM.
As a Gamer, you play by the rules.
As a Programmer, you play as God.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|