Page 1 of 1

Attanck

Posted: Mon Jun 04, 2012 6:54 am
by Cloete
Attanck – is my contribution for those who need to pass the time while waiting for the kettle to boil and for the toaster to do its thing. Also for new comers to the Dragon – I left this Basic program without an autorun so you could fiddled with the code/formula if you want to.
It’s your tank against the Dragon’s. Classic 2D canon trajectories, velocity, angle, exploding mountains, trajectory tracer paths, shots summary list, four levels, etc. I left out the air resistence in the trajectory formula otherwise the games gets too slow. You can add it if you wish, or fool around with the current gravity of 9.8.
It’s in Basic – CLOAD & RUN.
LOADING TIPS for this baby:
1. It loads on my side from my Compaq laptop (set at max volume) into my real Dragon.
2. Only the EARPHONE is plugged in.
3. Also – my laptop’s built-in microphone forces me to KEEP VERY QUIET during loading, otherwise any additional sounds results in the all too familiar I/O E.
Regards,
Cloete

Re: Attanck

Posted: Mon Jun 04, 2012 9:29 pm
by zephyr
Thanks Cloete! :) The converted .cas file is attached.

Re: Attanck

Posted: Wed Jun 06, 2012 11:18 pm
by zephyr
Cloete wrote:Attanck – is my contribution for those who need to pass the time while waiting for the kettle to boil and for the toaster to do its thing. Also for new comers to the Dragon – I left this Basic program without an autorun so you could fiddled with the code/formula if you want to.
I made a few minor modifications to the code as you suggested.

* Changed the "GOTO 1940" in line 10 to "GOSUB 1940"
* Deleted the "GOSUB 1580" from line 20
* Deleted the unused line 1580
* Added a "GOSUB 1590" to line 10
* Moved the "CLEAR200:PCLEAR8" from line 1940 to line 10
* Put "A=RND(-TIMER)" on line 1940
* Replaced the "GOTO 20" in line 2600 with a "RETURN"
* Added an extra line which checks for minimum (2) and maximum (10) length when inputting the player's name
* Added an extra line which checks for minimum (2) and maximum (10) length when inputting the enemy's name
* Modified the routine at line 120 which checks for correct entry of the "Tracer Trajectory" off/on value
* Modified the INKEY$ check in line 1200 so it pauses unless the space bar is pressed
* Modified the INKEY$ check in line 1350 so it pauses unless the space bar is pressed
* Deleted the unused line 1210
* Added Steve Woolham's PCLEAR fix v2.0 to the CoCo version
* Renumbered the program

I have attached the modified Dragon game along with a CoCo compatible version.

Re: Attanck

Posted: Thu Jun 07, 2012 6:37 am
by Cloete
One question though - what does A=RND(-TIMER) do? Same as a normal RND() :?:
A=RND(-TIMER) was also added to my Eartquaker... will this work on a real Dragon?
I will be with my real Dragon only from Friday evening - hope you can tell me before then.
(Also struggling to get the emulator going, but that will have to wait).

Re: Attanck

Posted: Thu Jun 07, 2012 9:04 am
by Sarah
It randomises the RND() function, i.e. sets an initial random number seed using the TIMER value (which is a 50Hz counter, so it'll tend to have a different value each time the program is RUN). This is a standard way to make the pseudo-random numbers returned by RND() unpredictable in practice (rather than producing the same sequence of numbers every time the Dragon is switched on) and I think it appeared in the Dragon manual ("An introduction to BASIC programming using the DRAGON"). The actual return value of RND(-TIMER) is itself inconsequential and usually ignored.

Re: Attanck

Posted: Thu Jun 07, 2012 12:11 pm
by zephyr
Sarah has explained it perfectly. As an example, please follow the suggested instructions below.

(1) Type in the following short program on your real Dragon 32 and save it to tape as "RNDTEST".

Code: Select all

20 A=RND(5)
30 B=RND(10)
40 C=RND(20)
50 PRINT A;B;C
(2) Now switch off/on your Dragon, load the program from tape, and run it just once.
(3) Repeat step 2 several times and carefully observe the displayed results.

(4) Load "RNDTEST" from tape, and add line "10 X=RND(-TIMER)"

Code: Select all

10 X=RND(-TIMER)
20 A=RND(5)
30 B=RND(10)
40 C=RND(20)
50 PRINT A;B;C
(5) Save the updated code to tape as "RNDTEST" so it overwrites the original, and return to step 3.
Cloete wrote:(Also struggling to get the emulator going, but that will have to wait).
I would be happy to help with the emulator if you start a new thread in the "Dragon General" forum.

Regards,
Steve