Hi there.
I am in the middle of doing my 1st college project. They have asked me to produce a Space Invaders game and for that I would like to use arrays. The problem is I can't get my pictures to work with arrays, I have been trying to figure out what the problem is from the last couple of days!
I tried to pass the arrays to other functions, but now even if I try to do something in Main it still doesn't work.
I have got a quick example over here, as I don't want to paste in the whole code (too much reading
). Could anyone please try to help me or at least explain what am I doing wrong?
#include "DarkGDK.h"
const int BULLET_IMAGE = 1;
const int BULLET_SPRITE = 1;
void DarkGDK()
{
const int SIZE = 10;
dbLoadImage("bullet1.bmp", BULLET_SPRITE);
int positionX[SIZE] = {0, 10, 20, 40, 60, 80, 100, 120, 140, 160};
int positionY[SIZE] = {550, 500, 450, 400, 350, 300, 250, 200, 150, 100};
//use the arrays to draw images
for (int index = 0; index < SIZE; index++)
{
dbSprite(BULLET_SPRITE, positionX[index], positionY[index], BULLET_IMAGE);
}
dbWaitKey();
}