6 hours ago, phil67rpg said:
I am trying to create a Boolean list, is this how I make the struct?
struct Brick
{
bool px;
bool py;
public:
Brick(bool px,bool py)
{}
};
here is my collision routine
for(int i=0; i<=9;i+=3)
{
if((bricks.begin(),i)==1)
{
DrawBitmap("paddle.bmp",600,200);
}
}
Phew... well... honestly, I think you should take a big step back and start doing some basic C++ tutorials before you try to make a game. There are so many problems in your code. For a simple boolean list, you don't need a struct, just:
std::list<bool> booleanList;
Why are you doing this:
bricks.emplace_front(i,130);
if your brick struct takes bools? I suppose the compiler will make an implicit cast to bool here but he should also emit a lot of warnings if you have not turned them off.
if((bricks.begin(),i)==1)
What is that supposed to do? I tested it and was really astonished that it even compiles (with warnings). I had to look up what the comma operator actually does. Apart from using commas in function declarations, definitions, calls and some other use cases, I have never thought about a comma operator being a thing (Here is a short explanation: https://www.fluentcpp.com/2018/07/31/how-to-get-along-with-the-comma-operator/). From what I got so far, you are getting an iterator to the first object, discard it, get the value of i and compare it to 2. So it's basically the same as
if(i == 1)
If you wanted to compare the i-th member of the list to 1, you have to look into my last post how you use std::next. Then you have to dereference the iterator and either use a member of the Brick class for comparison or define the operator == for the Brick class. If you don't understand what I am talking about then again:
Stop your current project and do some C++ tutorials until you start understanding what I want to tell you.
Greetings