I want my app to send balls going down the screen slower and as time goes up the balls go down faster . Can someone help me with this problem ? I don’t know where to start .
Things you can do separately or in combination:
-
Over time, change gravity setting: https://docs.coronalabs.com/api/library/physics/setGravity.html
-
Set a non-zero linear damping on balls: https://docs.coronalabs.com/api/type/Body/linearDamping.html
-
Choose a gravity scale less than one for the balls: https://docs.coronalabs.com/api/type/Body/gravityScale.html
Not every game using physics you know… so you can decrease your delta in your enterFrame()
How would I do that ?
I want my app to send balls going down the screen slower and as time goes up the balls go down faster . Can someone help me with this problem ? I don’t know where to start .
Without wanting to sound harsh, you’ve been on these forums for nearly three years with a post count nearing 1,000, and if you still don’t know where to start on a fairly simple problem like this, I’d question how much you’ve learnt in that time. We could post code, but if you’re not going to take on board the thinking and techniques behind it, what’s the point?
I’m not trying to discourage but being realistic, if I’d been training to be a carpenter for three years and still couldn’t build a table without step-by-step instructions, I’d be asking myself some questions!
I just changed my physics from this
physics.setGravity(0,9.8)
to this
physics.setGravity(0,15)
But the balloons are still falling down fast . I have 0,5 but they were moving slow I had 0,10 and it was also moving slow
Question: Did you expect gravity of <0,15> to be faster or slower?
I expected it to move slower then gradually move faster . That was my original question . I tried two of those links you gave me i’ll try the third
I’m super confused. Do you want to control the velocity or acceleration?
As I often ask, can you think of any games that exist and have a YouTube video that demonstrate the movement you are trying to emulate? If so, share a link to that video here.
Sorry I don’t have any games I could think of . But i’ll try to walk you through it.
When the user clicks the start button they go into the game . When there in the game the balloons start falling . I want the balloons to slowly fall for about 5 seconds and then gradually speed up .
I’m confused (above) because acceleration due to gravity will increase the velocity of an object, so gravity should be good enough as you describe your problem.
However, maybe you want the rate of increase to increase too. i.e. You want the effect of gravity to increase for individual objects.
Oh, and you need to be a little more clear. Your title says you want the balls to move slower, the body says faster. I typically answer based on the title and let the body further inform me.
Gravity Scale is the solution to adjusting the affects of gravity on a PER OBJECT basis.
Yeah . I want the balloons to gradually increase faster and faster . How do I control the speed at which they are falling to the bottom of the screen ?
The concept of variable gravity is super easy to experiment with.
https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/02/variableGravity.rar
https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/02/variableGravity.zip
https://www.youtube.com/watch?v=c9AlgizoHNo&feature=youtu.be
local physics = require "physics" physics.start() -- No adjustment to Gravity Scale local obj = display.newImageRect( "balloon1.png", 295/4, 482/4 ) obj.x = 100 obj.y = 80 physics.addBody( obj ) -- Gravity Scale Starts And Stays At 0.5 local obj = display.newImageRect( "balloon3.png", 295/4, 482/4 ) obj.x = 250 obj.y = 80 physics.addBody( obj ) obj.gravityScale = 0.5 -- Gravity Scale Increases Gradually from 1 to 3 over 2 seconds local obj = display.newImageRect( "balloon3.png", 295/4, 482/4 ) obj.x = 400 obj.y = 80 physics.addBody( obj ) transition.to( obj, { gravityScale = 3, time = 2000 }) -- Gravity Scale Decreases Gradually from 1 to 0.1 over 1 seconds local obj = display.newImageRect( "balloon5.png", 295/4, 482/4 ) obj.x = 550 obj.y = 80 physics.addBody( obj ) transition.to( obj, { gravityScale = 0.1, time = 1000 })
Gradually increase acceleration?
Gradually increase velocity?
Still confused.
Speed ~= acceleration.
Purely for the benefit of others that might stumble across this post…
Speed= m/s whereas acceleration = m/s/s. Acceleration is the rate of change of speed (or velocity) - this is basic middle school physics.
If an object is moving at 2 m/s and you apply an acceleration of 2 m/s/s for 1 second the object is now moving at 4 m/s. Apply it for another second and the object is now moving at 6 m/s.
Things you can do separately or in combination:
-
Over time, change gravity setting: https://docs.coronalabs.com/api/library/physics/setGravity.html
-
Set a non-zero linear damping on balls: https://docs.coronalabs.com/api/type/Body/linearDamping.html
-
Choose a gravity scale less than one for the balls: https://docs.coronalabs.com/api/type/Body/gravityScale.html
Not every game using physics you know… so you can decrease your delta in your enterFrame()
How would I do that ?