![]() |
| ||
| Python Graphics Help 1 Attachment(s) Hello, I'm having trouble with a project that I am doing in turtle graphics. I'm making a graphic of a soccer field with a ball bouncing around, but I want the ball to stop when it hits the net. I can get the ball to stop when it hits the net though, it keeps on bouncing. Any suggestions would be appreciated. The if statement that I am trying to use is if -100>x>100 and -25>y>25:\ return and I have an attachment of the work I have done. |
| ||
| Re: Python Graphics Help I am experimenting with your attachment. Please do not mix tabs and spaces for indentations, stick with spaces! A few comments would be nice! It just makes it nicer for other people to use and check your code. What do you want to use to start the program? Just for initial testing I am using soccer(1000, 1, 30) You could score goals as your x,y coordinates of the turtle fall within the range of the goal-fronts. |
| ||
| Re: Python Graphics Help The turtles are active! This is sure an interesting game. I changed the soccer function to this ... def soccer(num_steps, step_size, heading):This way you can keep track of right and left goal scores. To make the game more interesting you may want to add a small random bounce to your deflections. |
| ||
| Re: Python Graphics Help Quote:
|
| ||
| Re: Python Graphics Help I have use the space/tab feature too, but don't always know how many spaces each tab is. |
| All times are GMT -4. The time now is 6:45 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC