home *** CD-ROM | disk | FTP | other *** search
/ Light / Light_Vol.1_August_1992_Datasphere_Publications_Disk_1_of_2_Side_B.d64 / demo.bas (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  5KB  |  280 lines

  1. 1000 rem ******************************
  2. 1001 rem **** demonstration patterns
  3. 1002 rem **** for 'spritez basic',
  4. 1003 rem **** by ian goffe, 1991.
  5. 1004 rem ******************************
  6. 1005 rem
  7. 1006 rem **** 'flush' movement patterns
  8. 1007 rem
  9. 1008 reset
  10. 1009 rem
  11. 1010 rem **** define an array to hold
  12. 1011 rem **** progressive 'jump' values
  13. 1012 rem **** to give the effect of
  14. 1013 rem **** gravitational velocity.
  15. 1014 rem
  16. 1015 dim delay(20)
  17. 1016 for l=1 to 20:read delay(l):next
  18. 1017 rem
  19. 1018 rem **** border/background colours
  20. 1019 poke761,0:poke762,0
  21. 1020 rem
  22. 1021 rem **** define background/sprite
  23. 1022 rem **** multi-colours.
  24. 1023 rem
  25. 1024 poke763,9:poke764,15:poke53285,6:poke53286,14
  26. 1025 rem
  27. 1026 rem        'pattern 0'
  28. 1027 rem        ------------
  29. 1028 rem
  30. 1029 rem   this pattern sets the
  31. 1030 rem   animation speed, sets
  32. 1031 rem   no vertical movement, but
  33. 1032 rem   sets horizontal motion with
  34. 1033 rem   a jump of 2, until x
  35. 1034 rem   reaches value 200+256; the
  36. 1035 rem   256 being governed by the
  37. 1036 rem   '1' in the 'xto' syntax.
  38. 1037 rem
  39. 1038 rem   once this is reached, then
  40. 1039 rem   a loop is set up which
  41. 1040 rem   continues as:-
  42. 1041 rem
  43. 1042 rem   move up and left until
  44. 1043 rem   the y co-ordinate is
  45. 1044 rem   at position 50, then
  46. 1045 rem   move down and right
  47. 1046 rem   until y is at 190.
  48. 1047 rem   then repeat the above...
  49. 1048 rem
  50. 1049 pattern 0:aspeed 3
  51. 1050 yjump 0
  52. 1051 xfunc 1:right:yfunc 0:xjump 2:xto 20,1
  53. 1052 move
  54. 1053 yfunc 1:xfunc 0
  55. 1054 label:yto 50
  56. 1055 left:up:xjump 1:yjump 1
  57. 1056 move
  58. 1057 right:down:xjump 2:yjump 2:yto 190
  59. 1058 move
  60. 1059 loop
  61. 1060 rem
  62. 1061 rem
  63. 1062 rem
  64. 1063 rem
  65. 1064 rem
  66. 1065 rem
  67. 1066 rem
  68. 1067 rem
  69. 1068 rem
  70. 1069 rem
  71. 1070 rem            pattern 1
  72. 1071 rem            ---------
  73. 1072 rem
  74. 1073 rem   moves right until x is at
  75. 1074 rem   position 60+256;
  76. 1075 rem   then move left until x is
  77. 1076 rem   at position 40.
  78. 1077 rem   repeat the above steps....
  79. 1078 rem
  80. 1079 pattern 1
  81. 1080 aspeed 2
  82. 1081 yfunc 0:xfunc 1:xjump 1:yjump 0
  83. 1082 label
  84. 1083 right:xto 60,1
  85. 1084 move
  86. 1085 left:xto 40,0
  87. 1086 move
  88. 1087 loop
  89. 1088 rem
  90. 1089 rem
  91. 1090 rem
  92. 1091 rem
  93. 1092 rem
  94. 1093 rem
  95. 1094 rem
  96. 1095 rem
  97. 1096 rem
  98. 1097 rem
  99. 1098 rem         pattern 2
  100. 1099 rem         ---------
  101. 1100 rem
  102. 1101 rem     this pattern only differs
  103. 1102 rem     from pattern 1 in the
  104. 1103 rem     fact that the speed
  105. 1104 rem     of movement is changed
  106. 1105 rem     between left & right
  107. 1106 rem     'bounces'.
  108. 1107 rem
  109. 1108 rem
  110. 1109 pattern 2:aspeed 5
  111. 1110 yfunc 0:xfunc 1
  112. 1111 label:xjump 1:yjump 0
  113. 1112 right:xto 160,0:xjump 1
  114. 1113 move
  115. 1114 left:xto 40,0:xjump 2
  116. 1115 move
  117. 1116 loop
  118. 1117 rem
  119. 1118 rem
  120. 1119 rem
  121. 1120 rem
  122. 1121 rem
  123. 1122 rem
  124. 1123 rem
  125. 1124 rem         pattern 3
  126. 1125 rem         ---------
  127. 1126 rem
  128. 1127 rem  this pattern 'bounces'
  129. 1128 rem  between the vertical
  130. 1129 rem  screen positions, 60 and 200
  131. 1130 rem
  132. 1131 rem
  133. 1132 pattern 3
  134. 1133 yfunc1:xfunc0:xjump 0:yjump 1:aspeed 6
  135. 1134 label
  136. 1135 yto 60:up:move
  137. 1136 yto 200:down:move
  138. 1137 loop
  139. 1138 rem
  140. 1139 rem
  141. 1140 rem
  142. 1141 rem
  143. 1142 rem
  144. 1143 rem
  145. 1144 rem
  146. 1145 rem
  147. 1146 rem        pattern 4
  148. 1147 rem        ---------
  149. 1148 rem
  150. 1149 rem  here is an example of the
  151. 1150 rem  use of the 'count' command.
  152. 1151 rem  what is actually happening
  153. 1152 rem  here is that downward motion
  154. 1153 rem  is specified, then a 'pixel'
  155. 1154 rem  jump value is read from the
  156. 1155 rem  pre-defined array, this is
  157. 1156 rem  then moved for a count of
  158. 1157 rem  '1', for each of the 20
  159. 1158 rem  jump values.
  160. 1159 rem  the 'jump' table is then
  161. 1160 rem  read and moved 'backwards',
  162. 1161 rem  giving upward motion; this
  163. 1162 rem  is then repeated...
  164. 1163 rem
  165. 1164 rem
  166. 1165 pattern 4:aspeed5
  167. 1166 xjump0:label:down:forl=1to20:count 1:yjump delay(l)
  168. 1167 move:nextl
  169. 1168 up:for l=20 to 1 step -1
  170. 1169 count 1:yjump delay(l)
  171. 1170 move:nextl
  172. 1171 loop
  173. 1172 rem
  174. 1173 rem
  175. 1174 rem
  176. 1175 rem
  177. 1176 rem
  178. 1177 rem
  179. 1178 rem       pattern 5
  180. 1179 rem       ---------
  181. 1180 rem
  182. 1181 rem   'pattern 5' is a reverse
  183. 1182 rem   of the previous pattern,
  184. 1183 rem   starting with upward motion
  185. 1184 rem
  186. 1185 rem
  187. 1186 rem
  188. 1187 rem
  189. 1188 pattern 5:aspeed 4
  190. 1189 xjump0:label:up:forl=20to1step-1:count 1:yjump delay(l)
  191. 1190 move:nextl
  192. 1191 down:for l=1 to 20
  193. 1192 count 1:yjump delay(l)
  194. 1193 move:nextl
  195. 1194 loop
  196. 1195 rem
  197. 1196 rem
  198. 1197 rem
  199. 1198 rem
  200. 1199 rem
  201. 1200 rem
  202. 1201 rem
  203. 1202 rem         pattern 6
  204. 1203 rem         ----------
  205. 1204 rem
  206. 1205 rem   the same delay/jump
  207. 1206 rem   principle is used here...
  208. 1207 rem   but in diagonal movement.
  209. 1208 rem
  210. 1209 rem
  211. 1210 rem
  212. 1211 rem
  213. 1212 rem
  214. 1213 pattern 6
  215. 1214 aspeed6:yjump1:label:down:right:forl=1to19:count 2:xjump delay(l)
  216. 1215 move:nextl
  217. 1216 up:left:for l=19 to 1 step -1
  218. 1217 count 2:xjump delay(l)
  219. 1218 move:nextl
  220. 1219 loop
  221. 1220 rem
  222. 1221 rem
  223. 1222 rem
  224. 1223 rem
  225. 1224 rem
  226. 1225 rem
  227. 1226 rem
  228. 1227 rem
  229. 1228 rem        pattern 7
  230. 1229 rem        ---------
  231. 1230 rem
  232. 1231 rem   a mixture of 'straight'
  233. 1232 rem   and 'diagonal' movement...
  234. 1233 rem   using a count value of 2,
  235. 1234 rem   this moves 'twice' for each
  236. 1235 rem   specified 'jump' value...
  237. 1236 rem
  238. 1237 rem
  239. 1238 rem
  240. 1239 pattern 7
  241. 1240 label:yjump1:animate1:aspeed3:down:left:forl=1to17:count 2:xjump delay(l)
  242. 1241 move:nextl:animate 0:aspeed3
  243. 1242 up:right:for l=17 to 1 step -1
  244. 1243 count 2:xjump delay(l)
  245. 1244 move:nextl:yjump 0
  246. 1245 xfunc1:xto 170,0:xjump 1:move
  247. 1246 loop 
  248. 1247 pattern 8
  249. 1248 rem
  250. 1249 rem
  251. 1250 rem
  252. 1251 rem
  253. 1252 rem
  254. 1253 rem        pattern 8
  255. 1254 rem        ---------
  256. 1255 rem
  257. 1256 rem   yet another example of
  258. 1257 rem   diagonal/delay movement...
  259. 1258 rem
  260. 1259 rem
  261. 1260 rem
  262. 1261 aspeed6:yjump1:label:up:left:forl=1to19:count 2:xjump delay(l)
  263. 1262 move:nextl
  264. 1263 down:right:for l=19 to 1 step -1
  265. 1264 count 2:xjump delay(l)
  266. 1265 move:nextl
  267. 1266 loop
  268. 1267 rem
  269. 1268 rem
  270. 1269 rem
  271. 1270 rem pack movement definitions...
  272. 1271 rem
  273. 1272 pack
  274. 1273 rem
  275. 1274 rem
  276. 1275 rem delay values for movement...
  277. 1276 rem
  278. 1277 data 0,0,1,1,1,1,2,2,2,2,2,2,2,2
  279. 1278 data 3,3,3,3,3,4
  280.