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

  • SEARCH
  • Home
  • 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 6021261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:41:14+00:00 2026-05-23T03:41:14+00:00

I have a sneaking suspicion I’m doing this wrong. It works now, to the

  • 0

I have a sneaking suspicion I’m doing this wrong. It works now, to the extend that gravity pulls the object down toward the ground, but I’m having trouble manipulating the speed of the object.

What this is, is a ball jumping and falling towards the ground.

I have another function called “jump” that just adds jSpeed to it’s yVel

I can increase gravity, and it falls faster.

I can increase the jSpeed speed, and it’ll rise up longer, but not faster

But I can’t get it to do everything faster. It just looks painfully slow, which may or may not be because of my emulator running at 11 fps, on average.

Is it just my emulator, or is it something on my end?

float time = elapsedTime/1000F;
if (speed < maxSpeed){
    speed = speed + accel;
}
if(mY + mVelY < Panel.mHeight){ //0,0 is top-left
    mVelY += (speed);
}

if (!(mY + height >= Panel.mHeight)){
    mVelY = mVelY  + gravity ;
}

mX  =  (float) (mX +(mVelX * time));
mY =  (float) (mY + (mVelY * time));
  • 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-05-23T03:41:15+00:00Added an answer on May 23, 2026 at 3:41 am

    I think you have the right general ideas here but a lot about your code is confusing.

    My issues are mostly about the variable speed – it seems to me that your ball is being accelerated up by the variables speed and accel until reaching a maximum speed. Opposing this is gravity pulling (accelerating) the ball down.

    Now typically this isn’t how a ‘jump’ the way you describe it is. So for me when the player hits ‘jump’ you should set the YVel to jspeed and just let the gravity part of the equation bring it back down – that is if you deleted the code:

    if(mY + mVelY < Panel.mHeight){ //0,0 is top-left
      mVelY += (speed);
    }
    

    Then it would go up for a bit and then loose momentum to the gravity and come back down – where as this code above keeps pushing it upwards until it hits the top, and as soon as it starts descending pushes it back up.

    I wonder if the code around speed and maxspeed is supposed to act on XVel and not YVel as you have coded – that would make more sense.

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

Sidebar

Related Questions

Have a matrix report now that has Position, Hours and Wages for a location
Now i know that this one is actually not a very technical question but
So lets say I have a table that looks something like this: ItemName ProductType
I have that sneaking feeling I'm missing something obvious: I ran RAILS_ENV=production bundle exec
I'm not sure if this is possible (complete non-flash developer speaking), but we have
Have a look at this picture alt text http://www.abbeylegal.com/downloads/2009-04-01/web%20part%20top%20line.jpg Does anyone know what css
Have a SomeLib.pro file that contains: CONFIG += debug TEMPLATE = lib TARGET =
I have a process that keeps dying in the same place, and claims to
I have an app that I am translating to a bunch of different languages.
We have a large C code base that has been developed over several decades.

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.