Hi everyone, been lurking the forums since I started a game dev course a few months ago...
I seem to have hit a problem... first off, I'm creating a 2d platform game, and I've been borrowing a bit of the Dark Invaders code.
what I'm trying to do is create my enemies by cloning them however many times I set int my
const int MAX_ENEMY
and I have used the bool array that dark invaders uses to check if the enemy is dead or alive.
I only want to spawn a single line of enemies off screen to walk in from the right.
here is a snip of my code:
the constants I'm using in this piece of code are
//************************
// ENEMY CONSTANTS *
//------------------------
// ENEMY ENEMY IMAGE CONSTANTS
const int ENEMY_IMG_WALK_L = 30;
// ENEMY ENEMY SPRITE CONSTANTS
const int ENEMY_SPRITE_WALK_L = 30;
// OTHER CONSTANTS
const int MAX_ENEMY = 10;
// VARIABLES
bool enemiesSpawned = false;
bool enemyAlive[MAX_ENEMY] = false;
float enemyX = 1000;
float enemyY = dbRnd(85) + 397;
void enemiesSpawn ( void )
{
// setup the enemies, load the images and sprites
enemiesSetup();
// set the initial position of all enemy sprites
for (int i = ENEMY_SPRITE_WALK_L; i <= ENEMY_SPRITE_WALK_L + MAX_ENEMY; i++)
{
// Make the animation start at random places
dbSetSpriteFrame( i ,dbRnd(9)+1);
// Place the clones
dbSprite( i, enemyX, enemyY, ENEMY_IMG_WALK_L);
dbSetSpritePriority( i, 2);
enemyAlive[i] = true;
// Place the ememies a random range between 200 and 400 apart
enemyX += dbRnd(200) + 200;
enemyY += dbRnd(85) + 397;
}
}
and the compiler gives me the error message
Quote: "error C2440: 'initializing' : cannot convert from 'bool' to 'bool [10]'
There are no conversions to array types, although there are conversions to references or pointers to arrays"
thanks to anyone that helps a n00b lol...