I am trying to insert an int into the array number but it wont work.
int middlePointx[3] = {
350, 400, 460
};
int imHere = 0;
imHere = 0;
joystick1.position = ccp(middlePointx[imHere].x,startingPoint1.y);
I get a member reference base type int is not a structure or union
On the contrary, your problem is that you are referencing an int, but your code tries to treat it like a point.
The expression middlePointx[0]
gives the value 350
— that's the first element of the array middlePointx
. So the expression middlePointx[imHere].x
is equivalent to 350.x
. Do you see where this is going wrong? The integer 350 is not a CGPoint — it doesn't have an x
member.
I think you just want middlePointx[imHere]
, with no member access at all.