|
The BOUNCE Program |
This program displays several items that bounce around the screen. To make this program work, you will need to combine your knowledge from the previous lessons. Consider this program a test of that knowledge. Create a new program and title it BOUNCE. Type the following code into it (the second column is simply a continuation of the first).
:Lbl 0 :7->O :14->P :1->G :1->H :1->E :1->F :7->T :3->U :1->X :2->Y :1->V :15->W :1->C :1->D :1->A :1->B :Menu("BOUNCE","TAILS",9,"NO TAILS",8,"QUIT",10 :Lbl 1 :Disp "WATCH THE","BOUNCING BALL!" :Pause :ClrHome :Lbl 2 :Output(X,Y,"." :Output(V,W,"o" :Output(T,U,"*" :Output(O,P,"0" :O+G->O :P+H->P :T+E->T :U+F->U :X+A->X :Y+B->Y :V+C->V :W+D->W :If O=8 :G*(-1)->G :If T=8 :E*(-1)->E
|
:If X=8 :A*(-1)->A :If V=8 :C*(-1)->C :If O=1 :G*(-1)->G :If T=1 :E*(-1)->E :If X=1 :A*(-1)->A :If V=1 :C*(-1)->C :If P=1 :H*(-1)->H :If U=1 :F*(-1)->F :If Y=1 :B*(-1)->B :If W=1 :D*(-1)->D :If P=16 :H*(-1)->H :If U=16 :F*(-1)->F :If Y=16 :B*(-1)->B :If W=16 :D*(-1)->D :If Z=1 :ClrHome :Goto 2 :Lbl 9 :Goto 1 :Lbl 8 :1->Z :Goto 1 :Lbl 10 :ClrHome :Stop
|
Try to figure out which variables are in control of movement, display, etc. Determine how the items bounce as they hit the walls. How does ClrHome affect whether or not tails trail the items? This should be an easy assignment. Once you have figured this out, you can modify the program as you wish. Have fun!
|
|
|