Problem with velocity

In code bellow ball falls in required point on ground but with small velocity. How to increase ball velocity with saving target point? Help please.

1
2
3
4
5
6
7
8
9
10
11
12
physics = require("physics")
physics.setDrawMode( "hybrid" )
physics.start()
 
ground = display.newRect(0, 0.75*display.contentHeight, display.contentWidth, display.contentHeight/4)
physics.addBody(ground, "static", {friction=2})
 
ball = display.newCircle(40, 0.75*display.contentHeight-8, 8)
ball:setFillColor(255,0,0)
physics.addBody(ball, {friction=1, radius=8})
 
ball:setLinearVelocity(100,-200)

How about this (or you could play with the gravity setting) :

1
2
3
4
5
6
7
8
9
10
11
12
physics = require("physics")
physics.setDrawMode( "hybrid" )
physics.start()
 
ground = display.newRect(0, 0.75*display.contentHeight, display.contentWidth, display.contentHeight/4)
physics.addBody(ground, "static", {friction=2})
 
ball = display.newCircle(40, 0.75*display.contentHeight-8, 8)
ball:setFillColor(255,0,0)
physics.addBody(ball, {friction=1, radius=8})
 
ball:setLinearVelocity(100,-400) -- change the second value to increase the speed

If I will do it, target point (point where ball collide with ground after motion) is changed. And I need to save target point coordinates. Changing gravity doesn't help because ball flies farther.

Ok. Do you want to stop the ball when it hits the ground ?

No. In my code ball hits the ground (after arc motion) in specified target point. Everything is good, but I do not like movement velocity. I need to increase velocity but my specified target point should not be changed.

views:1330 update:2011/10/15 21:01:16
corona forums © 2003-2011