Apply force problems

I am using the following code

ball:applyForce( 17, 10, ball.x, ball.y )  

The ball is shot out when a button is pressed.

there are two levels. The first one goes to the second, and the second one goes to the first… when it goes back for the second level. the ball does not apply force again? How can i fix this?
Thanks [import]uid: 24708 topic_id: 19622 reply_id: 319622[/import]

We would really have to see more code in order to answer that - the code you show is fine.

Are you using director?

Peach :slight_smile: [import]uid: 52491 topic_id: 19622 reply_id: 76133[/import]

I agree that more code would be helpful.

However applyForce() is meant to be used if you want to apply the same force on an object over a length of time (think rocket).
If you just want a momentary kick in a certain direction you should use applyLinearImpulse(). [import]uid: 70847 topic_id: 19622 reply_id: 76140[/import]

This is good advice, however which ever you are using it should repeat on return to the scene - so yes, more code, please! [import]uid: 52491 topic_id: 19622 reply_id: 76152[/import]

I realized that the code was working, and it is the second level that is causing the problems… I realized this cause i made a test.lua level which went back to the first level, and it was fine… I’m going to try to figure this out if not i will write again on this post…
Ingemar - thanks for the idea on Apply Linear Impulse, it works great!
Peach - Im going to try to figure this out! Thanks for the help Tho!
[import]uid: 24708 topic_id: 19622 reply_id: 76436[/import]

Well done on further isolating the problem, it’s a very important part of debugging.

Let us know how you go!

Peach :slight_smile: [import]uid: 52491 topic_id: 19622 reply_id: 76545[/import]

The ball was simply dropping when i came back to the first level(sorry its a little confusing). So i was uncommenting out things until it started to work again… I found out that i used the following code, and i never reset it back to default on the first level!

physics.setScale( 10 ) -- default is 30  

very stupid of me! [import]uid: 24708 topic_id: 19622 reply_id: 76614[/import]

When the game is over i am trying to show a scorecard. It will be based off of 10 points of criteria. What would be the best way to approach this?
I would have like 10 columns and about 2 rows.

A very inefficient way that i was thinking is to make it using a picture as a background and filling each and every box.

I am trying to learn about tables now, but i haven’t seen how to actually print a table on the screen.
Could someone give me an example on how to do this? [import]uid: 24708 topic_id: 19622 reply_id: 76619[/import]

Hey Brian,

You actually would show the numbers individually in each box, although if they were stored in a table you could grab them from there.

You could set them up fairly easy using a for loop rather than adding each bit of text one at a time.

Does that make sense?

Peach :slight_smile: [import]uid: 52491 topic_id: 19622 reply_id: 76853[/import]