Page 200 - Learn to Program - Basic-256
P. 200

Chapter 13: Images, WAVs, and Sprites                                           Page 184


             16     while true
             17             spritemove 0, dx, dy
             18             if spritex(0) <= spritew(0)/2 or spritex(0) >=
                    graphwidth - spritew(0)/2 then
             19                    dx = dx * -1
             20                    wavplay
                    "4359__NoiseCollector__PongBlipF4.wav"
             21             end if
             22             if spritey(0) <= spriteh(0)/2 or spritey(0) >=
                    graphheight - spriteh(0)/2 then
             23                    dy = dy * -1
             24                    wavplay
                    "4361__NoiseCollector__pongblipA_3.wav"
             25             endif
             26             pause .05
             27     end while
        Program 82: Bounce a Ball with Sprite and Sound Effects



























        Sample Output 82: Bounce a Ball with Sprite and Sound Effects




               As you can see in Program 82 the code to make a ball bounce around the
               screen, with sound effects, is much easier than earlier programs to do this


                                                       © 2019 James M. Reneau (CC BY-NC-SA 3.0 US)
   195   196   197   198   199   200   201   202   203   204   205