News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_AMSDOS

BASIC Ink Animation Query

Started by AMSDOS, 09:50, 03 October 17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AMSDOS

I've written a routine in BASIC using INK animation to give the illusion of Horizontal moving scenary for hopefully an upcomming program next year. What I've done works, though I can't help but wonder if it could be improved. For example what I've produced doesn't have one MOD operator in it and as this code has alternating colours in it, I can't help but feel I could reduce code size with it perhaps. Unfortunately I'm puzzled where a MOD could be used.  :-[


This is the output I'm after:


[attachimg=1]


And the source:




100 MODE 0:INK 0,0:INK 1,26:INK 2,13:INK 3,3:INK 4,0:INK 5,0
110 SYMBOL 254,126,131,129,129,139,85,170,84:SYMBOL 255,0,124,126,126,116,0,0,0
120 PRINT CHR$(22);CHR$(1);
130 i3%=2:i4%=4:y%=7
140 WHILE y%<17
150   FOR x%=6 TO 15
160     i%=i3%
170     GOSUB 1000
180     x%=x%+1
190     i%=i4%
200     GOSUB 1000
210   NEXT x%
220 i3%=4:i4%=2
230 WHILE y%=8
240   y%=14:i3%=2:i4%=4
250 WEND
260 y%=y%+1
270 WEND
280 PRINT CHR$(22);CHR$(0);
290 PEN 1
300 INK 2,13,0:INK 3,3,0
310 INK 4,0,13:INK 5,0,3
320 SPEED INK 5,5
330 END
1000 FOR c%=1 TO 2
1010   LOCATE x%,y%
1020   PEN i%
1030   PRINT CHR$(254);
1040   LOCATE x%,y%
1050   PEN i%+1
1060   PRINT CHR$(255);
1070 NEXT c%:RETURN
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

AMSDOS

#1
I've access the situation for carefully in the following program and I couldn't find a way where MOD would alternate the INKs between 2 & 4.


100 MODE 0:INK 0,0:INK 1,26:INK 2,13:INK 3,3:INK 4,0:INK 5,0
110 SYMBOL 254,126,131,129,129,139,85,170,84:SYMBOL 255,0,124,126,126,116,0,0,0
120 PRINT CHR$(22);CHR$(1);
130 i3%=2:i4%=4:y%=7
140 WHILE y%<17
150   FOR x%=6 TO 15
160     i%=i3%
170     GOSUB 1000
180     x%=x%+1
190     i%=i4%
200     GOSUB 1000
210   NEXT x%
220 i3%=4:i4%=2
230 WHILE y%=8
240   y%=14:i3%=2:i4%=4
250 WEND
260 y%=y%+1
270 WEND
280 PRINT CHR$(22);CHR$(0);
290 PEN 1
300 INK 2,13,0:INK 3,3,0
310 INK 4,0,13:INK 5,0,3
320 SPEED INK 5,5
330 END
1000 FOR c%=1 TO 2
1010   LOCATE x%,y%
1020   PEN i%
1030   PRINT CHR$(254);
1040   LOCATE x%,y%
1050   PEN i%+1
1060   PRINT CHR$(255);
1070 NEXT c%:RETURN


However as I was using the FOR loop in my Subroutine (1000..1070) for something initially, though all I could find in this case was a Loop that was slowing down the drawing cycle. It can either be replaced with this:


1000 LOCATE x%,y%
1010 PEN i%
1020 PRINT CHR$(254);
1030 LOCATE x%,y%
1040 PEN i%+1
1050 PRINT CHR$(255);
1060 RETURN


or:


1000 FOR c%=254 TO 255
1010   LOCATE x%,y%
1020   PEN i%
1030   PRINT CHR$(c%);
1040   i%=i%+1
1050 NEXT c%
1060 RETURN


both of those seem to equally do as well.


Has anybody else had a look at this routine to see what direction the pattern is moving?
Obviously it's meant as a form of trickery for the eyesight. For myself it appears Left to Right, though with difficulty I could see it briefly move Right to Left. The speed for which the INKs are interchanging at if I slowed it down, it could be easier to make it look Right to Left for myself.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Powered by SMFPacks Menu Editor Mod