D-Bug & Automation Forum
D-Bug & Automation Forum >> Coding >> Sauron's homework! (assignment #1 - bouncy)
https://d-bug.mooo.com/dbugforums/cgi-bin/yabb2/YaBB.pl?num=1304238634

Message started by ggn on 01.05.11 at 08:30:33

Title: Sauron's homework! (assignment #1 - bouncy)
Post by ggn on 01.05.11 at 08:30:33
Assignment #1 - bouncy thing!

So, let's say you want to control a bouncy ball. Here are its characteristics:

  • This ball moves diagonally in 1 pixel increments
  • Once it hits an axis, its direction changes (for example if it goes down and right and hits the bottom border, it'll go up and right)
  • The top and bottom border coords are (0,0) and (320,240)
  • [edit]The ball moves on its own, no user interraction is required.[/edit]
  • [edit]The ball initially starts at the middle of the screen and moves down-left.[/edit]



Task #1 - Provide code to control the ball
Task #2 (optional) - Assume that the borders aren't fixed and can vary. Change Task #1's code to reflect this change
Task #3 (optional) - Modify the Downfall source so it'll show that ball

That is all. Have fun, and again, everyone that wants to have a shot at this is very welcome to, not just Sauron :)

D-Bug & Automation Forum » Powered by YaBB 2.6.0!
YaBB Forum Software © 2000-2022. All Rights Reserved.