Updating Screen Boundaries
Posted: Thu May 27, 2010 9:14 pm
Hey Guys,
I'm working on a game for the iPhone that right now is just a background and some screen boundaries the back ground is currently 640x960 which is twice the size of the iphone screen so that the background has to move around depending on where the user is at...I've got this working the background moves just fine, what I can't get is the screen boundaries to move...they are normal screen boundaries found on the many examples in this forum.
floorBody = cpBodyNew(INFINITY, INFINITY);
leftWallBody = cpBodyNew(INFINITY, INFINITY);
rightWallBody = cpBodyNew(INFINITY, INFINITY);
ceilingBody = cpBodyNew(INFINITY, INFINITY);
cpShape* floorShape = cpSegmentShapeNew(floorBody, cpv(-160,0), cpv(480,0), 1);
floorShape->e = 0.6;
floorShape->u = 0.3;
floorShape->collision_type = 0;
cpSpaceAddShape(space, floorShape);
floorShape = cpSegmentShapeNew(leftWallBody, cpv(-160,0), cpv(-160,960), 1);
floorShape->e = 0.6;
floorShape->u = 0.3;
floorShape->collision_type = 0;
cpSpaceAddShape(space, floorShape);
floorShape = cpSegmentShapeNew(ceilingBody, cpv(-160,960), cpv(480,960), 1);
floorShape->e = 0.6;
floorShape->u = 0.3;
floorShape->collision_type = 0;
cpSpaceAddShape(space, floorShape);
floorShape = cpSegmentShapeNew(rightWallBody, cpv(480,0), cpv(480,960), 1);
floorShape->e = 0.6;
floorShape->u = 0.3;
floorShape->collision_type = 0;
cpSpaceAddShape(space, floorShape);
//End Screen Boundaries
I've read the documentation and it says to not update the body per step but I don't know how else to change the position of the boundaries... if anyone could point me in the right direction I would appreciate it.
Thank you in Advance
I'm working on a game for the iPhone that right now is just a background and some screen boundaries the back ground is currently 640x960 which is twice the size of the iphone screen so that the background has to move around depending on where the user is at...I've got this working the background moves just fine, what I can't get is the screen boundaries to move...they are normal screen boundaries found on the many examples in this forum.
floorBody = cpBodyNew(INFINITY, INFINITY);
leftWallBody = cpBodyNew(INFINITY, INFINITY);
rightWallBody = cpBodyNew(INFINITY, INFINITY);
ceilingBody = cpBodyNew(INFINITY, INFINITY);
cpShape* floorShape = cpSegmentShapeNew(floorBody, cpv(-160,0), cpv(480,0), 1);
floorShape->e = 0.6;
floorShape->u = 0.3;
floorShape->collision_type = 0;
cpSpaceAddShape(space, floorShape);
floorShape = cpSegmentShapeNew(leftWallBody, cpv(-160,0), cpv(-160,960), 1);
floorShape->e = 0.6;
floorShape->u = 0.3;
floorShape->collision_type = 0;
cpSpaceAddShape(space, floorShape);
floorShape = cpSegmentShapeNew(ceilingBody, cpv(-160,960), cpv(480,960), 1);
floorShape->e = 0.6;
floorShape->u = 0.3;
floorShape->collision_type = 0;
cpSpaceAddShape(space, floorShape);
floorShape = cpSegmentShapeNew(rightWallBody, cpv(480,0), cpv(480,960), 1);
floorShape->e = 0.6;
floorShape->u = 0.3;
floorShape->collision_type = 0;
cpSpaceAddShape(space, floorShape);
//End Screen Boundaries
I've read the documentation and it says to not update the body per step but I don't know how else to change the position of the boundaries... if anyone could point me in the right direction I would appreciate it.
Thank you in Advance