PDA

View Full Version : Screen label and input


jaffaaswami
10-27-2010, 12:42 PM
Hi friends,

Hope you are all doing great. I was trying to go through the world demos available in the help menu. I have found two interesting things there

1) I want to know the process by which we can constraint the score board in duck court game. The score keeps on incrementing by 1 whenever you hit a duck with the ball. If I have to constraint that to 10 and then print a message saying "congratulations U have won! ", how do I go ahead with that ?

2) If I have to provide an option to the user to select the speed of the ball dynamically on the screen instead of changing it in the code statically, What changes should I make to the code.

Please provide me the code so that I can implement it and make necessary changes. All of you have been very helpful to beginners like me. Thanks a lot for your cooperation.:)

Regards,
Swami

Jeff
10-27-2010, 04:37 PM
1. Theres a variable called scoreLabel.score that it incremented in the onCollide function. When that is equal to 10 you can change the scoreLabel message to say congratulations.

2. You can change the ball speed after a GUI event occurs. For example, if you are using a slider, once the slider position is changed you could get it's position and base the speed on that. The documentation has examples of using GUI objects and handling GUI events.

jaffaaswami
10-29-2010, 03:22 PM
Hi Jeff,

I was successful in changing the message to 'congrats' after reaching a target score. But how to end the game... I mean how to disable the onscreen events after that particular target is reached ? Another question is the slider thing didnt work at all with all the possible combinations... can u help me out on this... The tutorial didnt work for me....

In the duck game if I have to randomly make the ducks move in both left and right directions what changes should I make to the code.. I am stuck with it... Hope u understand...

THanks
Swami