I am desperately trying to create a platform type of game. I have created many static bodies as my ground. When the player gets to the edge of the screen, I am trying to make those static bodies go the inverse direction the player is going. Can static bodies not move?
I did the following:
-Created b2PolygonDef();
-Created b2BodyDef();
-Linked a Sprite to the userData
Created a Variable and assigned it the following:
-Variable = m_world.CreateStaticBody(bodyDefVariableHere);
-Variable.CreateShape(polyDefVariableHere);
-Variable.SetMassFromShapes();
I have the steps and iterations called upon an Event Listener.
It all works fine, if they were non static shapes. Is there a way to have it so static shapes can move?
Also, if they can, are there any tricks to keep the velocity of the player the same while player moves to the right, and also move
all of the static shapes inversely so that when they are moved inversely, it doesn't appear as if it speeds up the speed at which the player is moving?
I know how would a static box move, haha. But, could I make it a non static box that does not move unless the player is moving.
Thanks.
I did the following:
-Created b2PolygonDef();
-Created b2BodyDef();
-Linked a Sprite to the userData
Created a Variable and assigned it the following:
-Variable = m_world.CreateStaticBody(bodyDefVariableHere);
-Variable.CreateShape(polyDefVariableHere);
-Variable.SetMassFromShapes();
I have the steps and iterations called upon an Event Listener.
It all works fine, if they were non static shapes. Is there a way to have it so static shapes can move?
Also, if they can, are there any tricks to keep the velocity of the player the same while player moves to the right, and also move
all of the static shapes inversely so that when they are moved inversely, it doesn't appear as if it speeds up the speed at which the player is moving?
I know how would a static box move, haha. But, could I make it a non static box that does not move unless the player is moving.
Thanks.