home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1993-01-08 | 3.2 KB | 78 lines |
- ' Simple Bouncing Ball Routine
- ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- '
- ' by Robert Iwancz December 1991
- ' ^^^^^^Weird surname isn't it? -�ROB�-
- '
- ' A MESSAGE FROM THE IDIOT AUTHOR OF THIS STUPID PROGRAM
- ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ' This is a simple routine to make a ball `bounce' around on the screen.
- ' It's all done with an AMAL string and even I was surprised at how simple
- ' it was to write. This routine is part of a game I was planning to write
- ' but changed my mind. So I thought I'd share this routine with you instead.
- ' But looking at the PD listing in the AMOS Club newletter I find there are
- ' quite a few disks with assorted AMOS programs and routines so there is
- ' probably a better routine for `bouncing balls' than mine on one of them!
- ' --->>>��� ROB ���<<<---
- ' ~~~
- '
- Curs Off : Flash Off : Hide
- '
- ' Let's make us a sprite (bob) to start of with.
- Cls 0
- Ink 2 : Circle 50,50,7 : Paint 50,50
- Get Sprite 1,42,42 To 58,58
- Hot Spot 1,$11
- Cls 0 : Ink 6 : Box 0,0 To 319,199
- ' It's an extremely boring ball isn't it?
- ' Well I guess I'm a pretty (sorry, ugly) boring person.
- ' If I'm boring then I don't deserve an Amiga do I?
- ' In case anyone wants to know, I'm a very boring 15 year old guy. As you
- ' have probably realised by now, one of my hobbies is going blind in front
- ' of my Commodore 1084 monitor which is hooked up to my Amiga 500...
- ' Did you know I don't like Football?...
- ' Nice weather we're having lately, don't you think?...
- ' Because I certainly DON'T!
- ' ...........
- ' What? Oh yes the STUPID bouncing ball thingy.
- ' For anyone who's interested, here it is...
- ' -�ROB�-
- '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- '
- ' >>> The AMAL string does it all! <<<
- '
- A$="Let R0=-5 ; Let R1=-5 ;" : Rem -----> The speed. Change it if you want.
- A$=A$+"Loop: Move R0,R1,1 ;" : Rem -----> R0 and R1 don't have to be the same.
- A$=A$+" Let R2=X<10 ; Let R3=X>310 ;"
- A$=A$+" Let R4=Y<10 ; Let R5=Y>190 ;"
- A$=A$+" If R2 & R4 then Jump C ; in case the"
- A$=A$+" If R3 & R5 then Jump C ; ball bounces"
- A$=A$+" If R2 & R5 then Jump C ; into a "
- A$=A$+" If R4 & R3 then Jump C ; corner"
- A$=A$+" If R2 | R3 then Jump A ;"
- A$=A$+" If R4 | R5 then Jump B ;"
- A$=A$+"Jump Loop ;"
- A$=A$+"A: Let R0=R0*-1 ; Jump Loop ;"
- A$=A$+"B: Let R1=R1*-1 ; Jump Loop ;"
- A$=A$+"C: Let R0=R0*-1 ; Let R1=R1*-1 ; Jump Loop ;"
- '
- ' >>> Simple isn't it? And to think that I hate algebra! <<<
- ' Did I mention that I also don't like football? -�ROB�-
- Screen 0 : Paper 0
- Locate ,10 : Centre "CLICK MOUSE TO STOP THIS THING!"
- Double Buffer
- Bob 1,150,150,1
- Channel 1 To Bob 1
- Amal 1,A$
- Amal On 1
- '
- ' And finally the main loop.
- Repeat
- Until Mouse Key
- '
- Locate ,10 : Cline : Centre "STUPID ISN'T IT?"
- '
- '
- ' I TOLD YOU IT WAS STUPID!!!
- ' --->>>��� ROB ���<<<---
- ' ~~~