0

I get this error but I have no idea where I could have went wrong here are the three functions below... I just really don't understand what is missing

void InitBullet(Bullet bullet[], int size) //init bullet
{
    for (int i = 0; i < size; i++)
    {
        bullet[i].ID = BULLET; //ID
        bullet[i].speed = 10; //bullet speed (10)
        bullet[i].live = false; //bullet isnt live it hasnt been fired
    }
}

void drawBullet(Bullet bullet[], int size) //drawing bullet to screen
{
    for (int i = 0; i < size; i++)
    {
        if (bullet[i].live) //if bullet is live
            al_draw_filled_circle(bullet[i].x, bullet[i].y, 2, al_map_rgb(255, 0, 0)); //red circle primitives for bullets
    }
}

void fireBullet(Bullet bullet[], int size, submarine &sub) //
{
    for (int i = 0; i < size; i++) //looking for deadbullets 
    {
        if (!bullet[i].live)
        {
            bullet[i].x = sub.x + 17; // 17 looks the best
            bullet[i].y = sub.y;
            bullet[i].live = true; // turning the bullet on
            break; //only one at a time
        }

    }
{
3
  • can u share the implementation of class Bullet is the member live a static member May 23, 2015 at 15:58
  • @yanivx sorry I fixed that error because it was just a typo on my behalf it was actually lives not live
    – im brett
    May 23, 2015 at 16:01
  • Hahaha :D ok no issues :) May 23, 2015 at 16:01

2 Answers 2

0

The last bracket is the wrong way around.

0

In my case the same error was caused by the fact that I forgot to declare a function of a partially specialized class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.