Re: please heeeelllpppp meeeee!


[Prev][Next][Index][Thread]

Re: please heeeelllpppp meeeee!



Ball bouncing games in basic are deathly slow, but here goes.  Say you
keep track of the location of the ball with two variables, X and Y.  Also
say that the direction the ball is moving is kept by two other variables,
DX and DY.  For example, to move the ball you say X+DX->X and Y+DY->Y.
Now, you have a playing field with two side walls.  You know the coordinates
of the walls.  Check X each time around, and if it is less than the
coordinate of the left wall or more than the coordinate of the right wall,
negate the movement, as in -DX->DX.  This makes it "bounce" away from the
wall, while still moving with the same DY.  Do the same thing with Y and DY
for the upper wall and lower wall (or "death zone" in breakout).


>hi,
>i am trying to make a game in TI-83 Basic and I want to know how to
>bounce the ball of the wall.  Like, the breakout game, how do you
>bounce the ball to the opposite angle when the ball hits the wall?
>i'd appreciate your help as soon as possible.
>thank you.