I need help with chests


(Cody) #41

Yeah but I haven’t checked in a while I will check now


(Cody) #42

Just did it everything checks out. But it still won’t add my score!


(Pharap) #43

Did you make sure to change the x and y to match up with the chests on your map?


(Simon) #44

Where exactly did you put the debugging? What did you log out? Can we see the output??

At the point indicated below, log out …

i
Chests[i].x
Chests[i].y
x
y
!Chests[i].opened

… then show us the output.

for(byte i = 0; i < ChestCount; i++)
  {
** Put serial.printlns here **
  if(Chests[i].x == x && Chests[i].y == y && !Chests[i].opened)
  {

(Cody) #45

The check is at the bottom of the main but I will try your way.


(Cody) #46

I will chect that today but it’s not measured in pixels its measured in boxes which are 4x8


(Scott) #47

This is why I said:

With “or instructions” meaning post an explanation and/or examples of the syntax yourself, in a way you feel it would be understood. Or, if you’re going to post working code, maybe include detailed comments on what the code’s purpose is or what it’s doing.


(Cody) #48

It says my Sprite is on the chest but when I press b nothing happens my chest count is set to 1 and my code is fine I don’t under stand I e raked the code I’ve made changes. I think it has something to do with the chest {3,4false} thing. Also can you explain that?


(Cody) #49

You were right I just checked my chests x and y are wrong sorry for being stubborn. Can you help me?


(Pharap) #50

So your first chest should be:

Chest Chests[] =
{
  { 16, 2, false }, // x, y, opened
};

Try that. If it works, have a go at adding the other 3 chests.


(Cody) #51

I just solved that! I’m a big idiot thanks all!