Original Post
[font="arial, sans-serif"]Ive recently begun creating arrays to use for my enemy ships. I thought this was most appropriate because there could be upto 100 on the screen at a time.[/font]
[font="arial, sans-serif"]i was wondering if i allocate an array with say [100] ; and i want to use 0-10 spaces of that array to perhaps be drawn at 200,300 , then 10-20 to be drawn at 300,400 how [/font]
[font="arial, sans-serif"]would i go about doing this.[/font]
[font="arial, sans-serif"]If your wondering why i want to use this is , its because im doing a side scroller shoot 'em up and the enemies need patterns.[/font]
[font="arial, sans-serif"]Heres an example of it working...[/font]
[font="arial, sans-serif"]This code creates one of enemies every 200 spaces across the X axis.[/font]
[font="arial, sans-serif"]As you can see im only allocating a maximum of 20 spaces for my array anyway.[/font]
[font="arial, sans-serif"]I could recreate a seperate array which will draw the enemies elsewhere but i think this would be overcomplicating things and just make the job tedious.[/font]
[font="arial, sans-serif"]
aEnemy = new Enemy[20];
//aEnemyWave2 = new Enemy[20];
for (int i = 0; i < 10; i++)
{
aEnemy = new Enemy(500 + (i * 200), 200, badShip);
}
for (int i = 10; i < 20; i++)
{
aEnemy = new Enemy(500 + (i * 200), 400, badShip);
}[/font]
[font="arial, sans-serif"]i was wondering if i allocate an array with say [100] ; and i want to use 0-10 spaces of that array to perhaps be drawn at 200,300 , then 10-20 to be drawn at 300,400 how [/font]
[font="arial, sans-serif"]would i go about doing this.[/font]
[font="arial, sans-serif"]If your wondering why i want to use this is , its because im doing a side scroller shoot 'em up and the enemies need patterns.[/font]
[font="arial, sans-serif"]Heres an example of it working...[/font]
[font="arial, sans-serif"]This code creates one of enemies every 200 spaces across the X axis.[/font]
[font="arial, sans-serif"]As you can see im only allocating a maximum of 20 spaces for my array anyway.[/font]
[font="arial, sans-serif"]I could recreate a seperate array which will draw the enemies elsewhere but i think this would be overcomplicating things and just make the job tedious.[/font]
[font="arial, sans-serif"]
aEnemy = new Enemy[20];
//aEnemyWave2 = new Enemy[20];
for (int i = 0; i < 10; i++)
{
aEnemy = new Enemy(500 + (i * 200), 200, badShip);
}
for (int i = 10; i < 20; i++)
{
aEnemy = new Enemy(500 + (i * 200), 400, badShip);
}[/font]