Skip to main content
improved language / layout / design
Source Link
Philip Allgaier
  • 2.9k
  • 4
  • 26
  • 36

IdI would control it all myself if iI were you, start. Start with a float and a vector2 and from there create 2dthe 2D physics yourself.

vector2 pos = (100, 100) float jump = 0; //this is the vertical momentum protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); if(Gamepad.GetState().IsKeyDown(Keys.Space)) { jump = -10; //upwards jump of 10 } pos.Y += jump; base.Update(gameTime); } 

nowNow just draw the sprite at pospos.

Id control it all myself if i were you, start with a float and a vector2 and from there create 2d physics yourself.

vector2 pos = (100, 100) float jump = 0; //this is the vertical momentum protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); if(Gamepad.GetState().IsKeyDown(Keys.Space)) { jump = -10; //upwards jump of 10 } pos.Y += jump; base.Update(gameTime); } 

now just draw the sprite at pos

I would control it all myself if I were you. Start with a float and a vector2 and from there create the 2D physics yourself.

vector2 pos = (100, 100) float jump = 0; //this is the vertical momentum protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); if(Gamepad.GetState().IsKeyDown(Keys.Space)) { jump = -10; //upwards jump of 10 } pos.Y += jump; base.Update(gameTime); } 

Now just draw the sprite at pos.

Source Link

Id control it all myself if i were you, start with a float and a vector2 and from there create 2d physics yourself.

vector2 pos = (100, 100) float jump = 0; //this is the vertical momentum protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); if(Gamepad.GetState().IsKeyDown(Keys.Space)) { jump = -10; //upwards jump of 10 } pos.Y += jump; base.Update(gameTime); } 

now just draw the sprite at pos