Hello everyone, as you might notice, I am very new working with this engine, and lately i have been experimentig with it a lot. I'm working on a platdormer game as many of you, and my main character has some kind of metalic legs with wheels at the end to
move, I took this character system from Danthekilla's amazing Car and Bridge example(thanks by the way), over the patches section so my character sonsists of a main rectangular body two wheels to pin joints and two revolute joints. I've been having a hard
work tweaking the movement of my character, but I still have a problem with the jetpack I want to Implement. The jetpack is selected when clicking in a blue boundingbox with the pointer, and then the mouse pointer becomes the control for the jetpack's impulse,
also the rotation of the main bodi gets nullified to stabilize the character , the Impulse added to the body is the result of the mouse world coordinates, from where i click, minus the main character position, the Method goes like this;
public void UpdateJetPack(GameTime gameTime, KeyboardState currentkeyboard,
Vector2 screenCenter, MouseState currentmousestate)
select.Update(screenCenter, system.CharacterPosition, system.CharacterPosition, system.CharacterBody.Rotation);// to update the pointer an the
// boundingbox response
jetpackselected = select.jetpackSelected;//boolean with boundingbox intersection response
Vector2 jetpackImpulse = new Vector2( select.pointer._mouseWorldPos.X - system.CharacterPosition.X,
select.pointer._mouseWorldPos.Y - system.CharacterPosition.Y); // the system class is the same as Danthekilla's Car class in his example
if (jetpackImpulse.X > characterPosition.X)
currentTurnState = TurnState.Right;
if ( jetpackImpulse.X < characterPosition.X)
currentTurnState = TurnState.Left;
if (jetpackselected == true)
currentState = State.Jetpack;
system.CharacterBody.Rotation = 0;//to stabilize the character
if (currentmousestate.LeftButton == ButtonState.Pressed)
The problem is that as i click to apply the impulse and move the character the wheels get out of their places, the joints start acting crazy, the boundingboxes and
the pointer gradually go out of the screen.
I have uploaded some Images, any suggestions for my character system or the movement are very welcomed.
This has nothing to do with the discussion but, is there a way to "lock" sprites together, as if i wanted to put a bounding box in my character's back and when he
rotated the bounding box wold rotate with him saying on his back?