|
| 1 | + |
| 2 | + rem ** color fade demo |
| 3 | + |
| 4 | + set doublewide on |
| 5 | + set tv ntsc |
| 6 | + |
| 7 | + dim xpos=a |
| 8 | + dim ypos=b |
| 9 | + dim frame=c |
| 10 | + dim herodir=d |
| 11 | + dim moving=e |
| 12 | + dim heroframe=f |
| 13 | + dim fadevalue=g |
| 14 | + |
| 15 | + displaymode 160A |
| 16 | + |
| 17 | + xpos=40 |
| 18 | + |
| 19 | + incgraphic gfx/tileset_blanks.png 160A 3 0 1 2 |
| 20 | + incgraphic gfx/tileset_rocks.png |
| 21 | + incgraphic gfx/scoredigits_8_wide.png |
| 22 | + incgraphic gfx/alphabet_8_wide.png 160A 0 2 1 3 |
| 23 | + |
| 24 | + incgraphic gfx/herodown1.png |
| 25 | + incgraphic gfx/herodown2.png |
| 26 | + incgraphic gfx/heroleft1.png |
| 27 | + incgraphic gfx/heroleft2.png |
| 28 | + incgraphic gfx/heroup1.png |
| 29 | + incgraphic gfx/heroup2.png |
| 30 | + incgraphic gfx/heroright1.png |
| 31 | + incgraphic gfx/heroright2.png |
| 32 | + |
| 33 | + P0C1=heroright2_color1 |
| 34 | + P0C2=heroright2_color2 |
| 35 | + P0C3=heroright2_color3 |
| 36 | + |
| 37 | + rem ** activate the graphics area with our tiles... |
| 38 | + characterset tileset_blanks |
| 39 | + |
| 40 | + clearscreen |
| 41 | + |
| 42 | + rem ** put the background down and save the screen before the main loop. |
| 43 | + rem ** this way we don't setup the background over and over again. |
| 44 | + |
| 45 | + plotmap screen1map 1 0 0 20 12 |
| 46 | + plotchars demotext 2 64 3 4 |
| 47 | + savescreen |
| 48 | + |
| 49 | + drawscreen |
| 50 | + |
| 51 | + frame=0 |
| 52 | + |
| 53 | +mainloop |
| 54 | + |
| 55 | + rem ** fade in and out... |
| 56 | + if frame<15 then fadevalue=fadevalue+1 |
| 57 | + if frame>127 && frame<143 then fadevalue=fadevalue-1 |
| 58 | + |
| 59 | + rem ** set the global fade value... |
| 60 | + setfade fadevalue |
| 61 | + |
| 62 | + rem ** fetch the fade values appropriate for our colors. |
| 63 | + rem ** note the "black" argument, which zeroes the hue nibble |
| 64 | + rem ** when the luminance nibble is zero. |
| 65 | + |
| 66 | + P1C1=getfade($12,black) |
| 67 | + P1C2=getfade($F6,black) |
| 68 | + P1C3=getfade($FC,black) |
| 69 | + |
| 70 | + P2C1=getfade($62,black) |
| 71 | + P2C2=getfade($86,black) |
| 72 | + P2C3=getfade($AC,black) |
| 73 | + |
| 74 | + rem ** we skip the "black" argument for the hero. you'll see him |
| 75 | + rem ** in the dark, since a hue with 0 luminance still gets displayed... |
| 76 | + P0C1=getfade(heroright2_color1) |
| 77 | + P0C2=getfade(heroright2_color2) |
| 78 | + P0C3=getfade(heroright2_color3) |
| 79 | + |
| 80 | + frame=frame+1 |
| 81 | + |
| 82 | + BACKGRND=$00 |
| 83 | + if joy0fire1 then BACKGRND=$38 |
| 84 | + if joy0fire0 then BACKGRND=$a8 |
| 85 | + |
| 86 | + rem ** move our hero in only the cardinal directions... |
| 87 | + moving=moving+1 |
| 88 | + if joy0down then ypos=ypos+1:herodir=0:goto doneherowalk |
| 89 | + if joy0up then ypos=ypos-1:herodir=2:goto doneherowalk |
| 90 | + if joy0left then xpos=xpos-1:herodir=1:goto doneherowalk |
| 91 | + if joy0right then xpos=xpos+1:herodir=3:goto doneherowalk |
| 92 | + moving=moving-1 : rem we didn't move |
| 93 | +doneherowalk |
| 94 | + |
| 95 | + restorescreen |
| 96 | + |
| 97 | + rem ** calculate which animation frame to display, based on direction and |
| 98 | + rem ** the walking counter... |
| 99 | + |
| 100 | + heroframe=(herodir*2)+((moving/16)&1) |
| 101 | + plotsprite herodown1 0 xpos ypos heroframe |
| 102 | + |
| 103 | + plotvalue scoredigits_8_wide 2 score0 6 56 11 |
| 104 | + plotvalue scoredigits_8_wide 2 score1 6 56 10 |
| 105 | + |
| 106 | + drawscreen |
| 107 | + |
| 108 | + goto mainloop |
| 109 | + |
| 110 | + alphadata demotext alphabet_8_wide |
| 111 | + 'demo' |
| 112 | +end |
| 113 | + |
| 114 | + alphachars ' abcdefghijklmnopqrstuvwxyz' |
| 115 | + |
| 116 | + alphadata screen1map tileset_blanks |
| 117 | + 'hifgfg fgfghi' |
| 118 | + 'hi hi' |
| 119 | + 'hi hi' |
| 120 | + 'fg fg' |
| 121 | + ' ' |
| 122 | + ' ' |
| 123 | + ' ' |
| 124 | + ' ' |
| 125 | + 'hi hi' |
| 126 | + 'hi hi' |
| 127 | + 'hi dehi' |
| 128 | + 'fgfgfg fgfgfg' |
| 129 | +end |
0 commit comments