Looking for some help (Error: Expected a Expression) >> Allegro
Code:
#include "I:\Documents\Visual Studio 2010\Projects\Coding Club Game\Coding Club Game\blocks.h"
#include <allegro.h>
#include <string>
using namespace std;
blocks::blocks()
{
place == {{true, true, true, true}, {true, true, true, true}};
}
void blocks::draw(BITMAP* buffer, ball &bl, int &score, SAMPLE* sound)
{
functs f;
for(int j = 0; j < 4; j++)
{
for(int i = 0; i < 4; i++)
{
if(f.collision(bl.x, bl.y, 10, 10, i*100+5, j*40 + 40, 100, 20) == true && place[j][i] == true)
{
place[j][i] = false;
score++;
play_sample(sound, 255, 128, 1000, false);
if(bl.dir == "NE")
bl.dir = "SE";
else if(bl.dir == "NW")
bl.dir = "SW";
else if(bl.dir == "N")
bl.dir = "S";
else if(bl.dir == "S")
bl.dir = "N";
else if(bl.dir == "SE")
bl.dir = "NE";
else if(bl.dir == "SW")
bl.dir = "NW";
}
if(place[j][i] == true)
rectfill(buffer, i*100+5, j*40 + 40, i*100+100, j*40 + 60, makecol(0, 255, 0));
}
}
}
The error is Line 10:
Code:
place == {{true, true, true, true}, {true, true, true, true}};
The
works fine, it is the first
that is giving a error.
Re: Looking for some help (Error: Expected a Expression) >> Allegro
What are you trying to accomplish with that line? It makes no sense to me.
Re: Looking for some help (Error: Expected a Expression) >> Allegro
its basically setting PLACE to true to wherever I use it as default, otherwise, i would ahve to set it to false.
Also side note-
Does [4][4] mean {{true,true,true,true} , {true,true,true,true}}
or does it mean
{{true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true})
OR
{{true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true} , {true,true,true,true}
Re: Looking for some help (Error: Expected a Expression) >> Allegro
What is PLACE?
And I need to repeat the question GCDEF already asked:
Quote:
Originally Posted by GCDEF
What are you trying to accomplish with that line? It makes no sense to me.
Re: Looking for some help (Error: Expected a Expression) >> Allegro
Code:
place == {{true, true, true, true}, {true, true, true, true}};
When trying to initialise a variable, use = and not == (which is the conditional equality). Also, this form of initialisation is only valid for a variable definiton.
So you could write
Code:
bool place[2][4] = {{true, true, true, true}, {true, true, true, true}};