Enemy Bullets

Started by
29 comments, last by BeerNutts 9 years, 3 months ago

I agree 2D shooters are silly if you are a serious person !, thanks for the -1.

Question ? : How many enemys do you have in screen ?, you might not have encountered this yet!

And suppose you explode all enemys at once ?, do you also play those sounds individual ?, i bet your speakers explode to ( especially with 64 or 128 channels playing at once )!

Now you have a -1 back from me, greetings.

Tip : dont drink alcohol, its bad for you.

I'm not sure why you think it's a "serious problem." It's not. Have you played a game where there are multiple people firing a gun at once? I'm sure you have. How did they solve this "serious problem"?

If you are concerned about playing too many sounds at once, you can of course limit the amount of simultaneous sounds you play in your sound engine easily. Whether 2 enemies or 100 enemies explode at the same time, you can limit the number of explosion sounds playing at once so your speakers don't "blow up to" (Let me add, playing 128 channels at once won't cause your speakers to blow up, it has nothing to do with it. it's the amplitude of the sounds coming out of the speakers that would cause them to "low up" not the number of mixed sounds signals coming out of the speaker at once).

Changing your game so enemies can only all fire at the same time is a terrible idea. You must agree with that. That kinda of shoot'em up would suck so bad. I'm sure the OP doesn't want to make that kind of game.

I'm sorry you got upset about having a -1, but think before posting, if what you are suggesting would make a game terrible, there's a chance you'll get a -1.

Good luck.

P.S., drinking alcohol is fine, just don't make it a habit.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Advertisement

Many games have this, but you did not notice it yet!

S T O P C R I M E !

Visual Pro 2005 C++ DX9 Cubase VST 3.70 Working on : LevelContainer class & LevelEditor


megallion, have your ships fire based on when you think the ships should fire, not because you might play a bunch of sounds around the same time.

I actually had to do a hack in my bullet system in how I pooled the soundManager: the soundManager would get multiple calls on any given tick (assuming more than one weapon was fired) but would only play the sound clip once. This game as a realization that fast-firing weapons allowed some sounds to stack in an improper manner and it really hurt the game's credibility / production value. Very unlean code, but managed to fix at least that.

On what framerate you have ticks ?, delayed sounds ?, or eliminate on frame basis.

S T O P C R I M E !

Visual Pro 2005 C++ DX9 Cubase VST 3.70 Working on : LevelContainer class & LevelEditor

I think i going to try implement something like that also,

then count the number, and have 4 different sounds, 1 without chorus, 2 with 1 extra chorus voice, 3 = 2 chorus voices, 4 = 3 chorus voices.

S T O P C R I M E !

Visual Pro 2005 C++ DX9 Cubase VST 3.70 Working on : LevelContainer class & LevelEditor

Okay well before I said that when I included a timer all my enemies would not shoot. Now I got them to shoot on a timer but only one shoots at a time. So one enemy comes out and it shoots, when that enemy gets destroyed the next one in the vector shoots.

Well, we don't have any code to help, but I bet you can work it out.

Where is your timer variable stored? It should be an EnemyShip class member variable since each ship should have it's own refire timer. You don't have it as a global variable do you?

Go though your code, ask yourself what happens. Try debugging and see why this is happening. Good luck.

The code is pretty much what I posted earlier in the thread. If you look at one of the functions theres a part of it thats commented out. That one has a timer and when I use that ships fire one at a time like i explained.

I'm going to really go through the code like you said though. Its just that it seems like its something that should be done so easily.

And to the other people about sound, I'm not sure I'm even going to have the enemy ships have a sound effect. I might just have music instead.

You should have both!?

S T O P C R I M E !

Visual Pro 2005 C++ DX9 Cubase VST 3.70 Working on : LevelContainer class & LevelEditor

Okay well before I said that when I included a timer all my enemies would not shoot. Now I got them to shoot on a timer but only one shoots at a time. So one enemy comes out and it shoots, when that enemy gets destroyed the next one in the vector shoots.

Well, we don't have any code to help, but I bet you can work it out.

Where is your timer variable stored? It should be an EnemyShip class member variable since each ship should have it's own refire timer. You don't have it as a global variable do you?

Go though your code, ask yourself what happens. Try debugging and see why this is happening. Good luck.

The code is pretty much what I posted earlier in the thread. If you look at one of the functions theres a part of it thats commented out. That one has a timer and when I use that ships fire one at a time like i explained.

I'm going to really go through the code like you said though. Its just that it seems like its something that should be done so easily.

No, that's only the function that acts on the "timer" My question was, where is the timer variable stored? Is it a global? That's the code I want to see.

It should be a member variable for in each instance of class you have.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Okay well before I said that when I included a timer all my enemies would not shoot. Now I got them to shoot on a timer but only one shoots at a time. So one enemy comes out and it shoots, when that enemy gets destroyed the next one in the vector shoots.

Well, we don't have any code to help, but I bet you can work it out.

Where is your timer variable stored? It should be an EnemyShip class member variable since each ship should have it's own refire timer. You don't have it as a global variable do you?

Go though your code, ask yourself what happens. Try debugging and see why this is happening. Good luck.

The code is pretty much what I posted earlier in the thread. If you look at one of the functions theres a part of it thats commented out. That one has a timer and when I use that ships fire one at a time like i explained.

I'm going to really go through the code like you said though. Its just that it seems like its something that should be done so easily.

No, that's only the function that acts on the "timer" My question was, where is the timer variable stored? Is it a global? That's the code I want to see.

It should be a member variable for in each instance of class you have.

The Timer variables are just stored in the EnemyShip class. I initialize it as currentTime = SDL_GetTicks() and lastTime is initialized to zero.


void Enemy1Bullet::EnemyBulletHandler(int posX, int posY)
{ 
	currentTime = SDL_GetTicks();
	if(currentTime > lastTime + 1000)
	{
		Enemy1Bullet* bullet = new Enemy1Bullet(); 
		bullet->box.x = posX + 50;
		bullet->box.y = posY + 35; 
		enemyBullets.push_back(bullet);
		lastTime = currentTime; 
	}
}

This topic is closed to new replies.

Advertisement