Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8614807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:12:38+00:00 2026-06-12T05:12:38+00:00

I have a player box2d object on screen, who should be controlled by two

  • 0

I have a player box2d object on screen, who should be controlled by two buttons, one left, and one right. When you press the right button, the player should move right, but when you press the left button, the player should immediatly stop moving right and move left. This should also happen vice versa.
I tried to do this to move right,
b2Vec2 impulse(4, 0);
body->ApplyLinearImpulse(impulse, body->GetWorldCenter());

and this to move left
b2Vec2 impulse(4, 0);
body->ApplyLinearImpulse(impulse, body->GetWorldCenter());

This works, but when I press right and then left, the player doesn’t immediatly go left, but continues right for a while, and then goes left. How do I make sure this doesn’t happen?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:12:40+00:00Added an answer on June 12, 2026 at 5:12 am

    set the body’s linearVelocity to b2Vec2_zero before applying the new force – LearnCocos2D yesterday

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question I have video player chrome buttons designed with HTML/CSS. The full screen button
I have setup a box2d world with a keyboard controlled player. The player can
So I have a Player view with seekbar and play/pause/rewind, etc. buttons, which are
I'm having an issue where I have a player object that I'm trying to
I have a baseball player super class I have a left field, center field,
I have a Player class that uses a ForeignKey to a Photo object for
I have a body (player) in my box2d world. Whenever I try to set
For example i have a player object with a list of suits of cards
I have one issue regarding box2d and cocos2d. My world have zero gravity and
I have created Player object as player = Manager.createPlayer(inputStream,audio/mpeg); and plays the audio as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.