[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - Updating Screen Boundaries

Updating Screen Boundaries

Share your projects and Chipmunk enhancements.

Updating Screen Boundaries

Postby ArtDev » 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
ArtDev
 
Posts: 3
Joined: Mon Apr 05, 2010 12:28 am

Re: Updating Screen Boundaries

Postby slembcke » Thu May 27, 2010 9:55 pm

I'm not sure I understand. You want the screen boundaries to move? Like as if the objects were placed inside a box and you were moving the box around with the objects inside of it? Somehow I'm thinking this isn't really what you want though.

You can move the position of a body every frame if you update its velocity to match (position delta divided by time).
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Updating Screen Boundaries

Postby Tam Toucan » Fri May 28, 2010 11:28 am

User avatar
Tam Toucan
 
Posts: 141
Joined: Tue Jun 23, 2009 4:26 pm


Return to Community Creations

Who is online

Users browsing this forum: No registered users and 1 guest

cron