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: Re: Sauron's homework! (assignment #1 - bouncy)
Post by Sauron on 02.05.11 at 23:09:42
Here's a partial, probably wrong answer, completely in pseudo-pseudo code:

define playfield (define borders of screen)
set up ball object
position ball object in center of screen
read joypad
  test direction of joypad press
    if pressed left, move ball left + down
    if pressed right, move ball right + down
compare position of ball to borders
  if ball = bottom border, move up + (left or right)
  if ball = top border, move down + (left or right)
  if ball = right border, move left + (up or down)
  if ball = left border, move right + (up or down)

I'll try to work out some actual code for this, provided I'm on the right track here.

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