Recent

Author Topic: Using a string script to draw level and animate character  (Read 357 times)

TBMan

  • Full Member
  • ***
  • Posts: 194
Using a string script to draw level and animate character
« on: May 30, 2025, 05:39:38 pm »
I'm teaching myself pixel art and animation. Here's my first attempt of a character (a Mario brother) walking on a level.
The string Info is setup to denote the level F=X change, U = Y decrease and X change, D = Y increase and X change.
The character sequence was created using my Animator tool. I had to drop one "cell" to get under the 20,000 character limit here.

Code: Pascal  [Select][+][-]
  1. program animationtest2;
  2.  
  3. uses
  4.   ptcGraph,
  5.   ptcCrt;
  6.  
  7. type
  8.   SpriteType = array[0..49, 0..23] of byte;
  9.  //DEFAULT.PAL
  10. CONST
  11. mar50x24A_0: SpriteType =
  12. ( (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  13.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  14.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  15.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  16.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  17.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  18.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  19.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  20.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  21.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  22.  (0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0),
  23.  (0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0),
  24.  (0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0),
  25.  (0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0),
  26.  (0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0),
  27.  (0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0),
  28.  (0,0,0,0,1,1,1,1,1,1,89,89,89,1,1,1,1,1,0,0,0,0,0,0),
  29.  (0,0,0,0,1,1,1,1,1,89,89,21,89,89,89,89,0,0,0,0,0,0,0,0),
  30.  (0,0,0,0,89,89,21,21,21,89,21,15,89,21,89,89,0,0,0,0,0,0,0,0),
  31.  (0,0,0,89,89,89,21,21,89,89,21,15,89,21,89,89,89,0,0,0,0,0,0,0),
  32.  (0,0,0,89,89,90,21,89,89,89,21,15,89,21,89,89,89,89,89,90,0,0,0,0),
  33.  (0,0,0,89,89,90,21,89,89,89,89,21,89,89,89,89,89,89,89,89,0,0,0,0),
  34.  (0,0,0,0,89,90,89,89,89,21,89,89,90,89,89,21,89,89,89,89,0,0,0,0),
  35.  (0,0,0,0,0,89,89,89,89,21,89,89,89,89,21,21,21,21,21,21,0,0,0,0),
  36.  (0,0,0,0,0,89,89,89,89,89,21,21,21,21,21,21,21,21,0,0,0,0,0,0),
  37.  (0,0,0,0,0,89,89,89,89,89,21,21,21,21,21,21,21,0,0,0,0,0,0,0),
  38.  (0,0,0,0,0,0,89,89,90,89,89,21,21,21,21,0,0,0,0,0,0,0,0,0),
  39.  (0,0,0,0,0,0,0,90,90,90,90,90,90,0,0,0,0,0,0,0,0,0,0,0),
  40.  (0,0,0,0,0,0,0,90,90,90,90,90,90,1,0,0,0,0,0,0,0,0,0,0),
  41.  (0,0,0,0,0,0,4,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0),
  42.  (0,0,0,0,0,4,4,4,4,1,1,4,4,4,0,0,0,0,0,0,0,0,0,0),
  43.  (0,0,0,0,4,4,4,4,4,1,1,4,4,4,4,0,0,0,0,0,0,0,0,0),
  44.  (0,0,0,0,4,4,4,4,4,1,1,4,4,4,4,0,0,0,0,0,0,0,0,0),
  45.  (0,0,0,0,4,4,4,4,4,1,1,4,4,4,0,0,0,0,0,0,0,0,0,0),
  46.  (0,0,0,0,90,90,4,4,4,1,15,1,1,1,0,0,0,0,0,0,0,0,0,0),
  47.  (0,0,0,90,90,90,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0),
  48.  (0,0,0,90,90,90,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0),
  49.  (0,0,0,90,90,90,1,1,1,1,17,1,1,1,1,0,0,0,0,0,0,0,0,0),
  50.  (0,0,0,0,0,0,1,1,1,17,1,1,1,1,1,0,0,0,0,0,0,0,0,0),
  51.  (0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0),
  52.  (0,0,0,0,0,0,0,0,19,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0),
  53.  (0,0,0,0,0,0,0,0,19,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0),
  54.  (0,0,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0),
  55.  (0,0,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0),
  56.  (0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0),
  57.  (0,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0),
  58.  (0,0,0,0,0,0,0,18,18,18,18,18,18,0,0,0,0,0,0,0,0,0,0,0),
  59.  (0,0,0,0,0,0,0,0,18,18,18,18,18,0,0,0,0,0,0,0,0,0,0,0),
  60.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  61.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
  62. //********
  63. mar50x24A_1: SpriteType =
  64. ( (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  65.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  66.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  67.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  68.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  69.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  70.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  71.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  72.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  73.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  74.  (0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0),
  75.  (0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0),
  76.  (0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0),
  77.  (0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0),
  78.  (0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0),
  79.  (0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0),
  80.  (0,0,0,0,1,1,1,1,1,1,89,89,89,1,1,1,1,1,0,0,0,0,0,0),
  81.  (0,0,0,0,1,1,1,1,1,89,89,21,89,89,89,89,0,0,0,0,0,0,0,0),
  82.  (0,0,0,0,89,89,21,21,21,89,21,15,89,21,89,89,0,0,0,0,0,0,0,0),
  83.  (0,0,0,89,89,89,21,21,89,89,21,15,89,21,89,89,89,0,0,0,0,0,0,0),
  84.  (0,0,0,89,89,90,21,89,89,89,21,15,89,21,89,89,89,89,89,90,0,0,0,0),
  85.  (0,0,0,89,89,90,21,89,89,89,89,21,89,89,89,89,89,89,89,89,0,0,0,0),
  86.  (0,0,0,0,89,90,89,89,89,21,89,89,90,89,89,21,89,89,89,89,0,0,0,0),
  87.  (0,0,0,0,0,89,89,89,89,21,89,89,89,89,21,21,21,21,21,21,0,0,0,0),
  88.  (0,0,0,0,0,89,89,89,89,89,21,21,21,21,21,21,21,21,0,0,0,0,0,0),
  89.  (0,0,0,0,0,89,89,89,89,89,21,21,21,21,21,21,21,0,0,0,0,0,0,0),
  90.  (0,0,0,0,0,0,89,89,90,89,89,21,21,21,21,0,0,0,0,0,0,0,0,0),
  91.  (0,0,0,0,0,0,0,90,90,90,90,90,90,0,0,0,0,0,0,0,0,0,0,0),
  92.  (0,0,0,0,0,0,0,90,90,90,90,90,90,1,0,0,0,0,0,0,0,0,0,0),
  93.  (0,0,0,0,0,0,4,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0),
  94.  (0,0,0,0,0,4,4,4,4,1,1,4,4,4,0,0,0,0,0,0,0,0,0,0),
  95.  (0,0,0,0,4,4,4,4,4,1,1,4,4,4,4,0,0,0,0,0,0,0,0,0),
  96.  (0,0,0,0,4,4,4,4,4,1,1,4,4,4,4,0,0,0,0,0,0,0,0,0),
  97.  (0,0,0,0,4,4,4,4,4,1,1,4,4,4,90,90,90,0,0,0,0,0,0,0),
  98.  (0,0,0,90,90,4,4,4,4,1,1,1,1,1,0,90,90,0,0,0,0,0,0,0),
  99.  (0,0,90,90,90,1,1,1,1,1,1,15,17,17,15,0,0,0,0,0,0,0,0,0),
  100.  (0,0,90,90,90,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0),
  101.  (0,0,0,90,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0),
  102.  (0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0),
  103.  (0,0,0,0,0,0,18,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0),
  104.  (0,0,0,0,0,0,1,18,1,1,1,1,1,1,1,1,1,19,0,0,0,0,0,0),
  105.  (0,0,0,0,0,0,1,1,18,18,1,1,1,1,1,1,19,19,0,0,0,0,0,0),
  106.  (0,0,0,0,0,1,1,1,1,0,0,0,1,1,1,19,19,19,0,0,0,0,0,0),
  107.  (0,0,0,0,0,1,1,1,1,0,0,0,1,1,19,19,19,19,0,0,0,0,0,0),
  108.  (0,0,0,0,0,1,1,1,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0),
  109.  (0,0,0,0,0,19,19,19,19,0,0,0,0,19,19,19,0,0,0,0,0,0,0,0),
  110.  (0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  111.  (0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  112.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  113.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
  114. //********
  115. mar50x24A_2: SpriteType =
  116. ( (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  117.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  118.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  119.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  120.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  121.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  122.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  123.  (0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0),
  124.  (0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0),
  125.  (0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0),
  126.  (0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0),
  127.  (0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0),
  128.  (0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0),
  129.  (0,0,0,0,1,1,1,1,1,1,89,89,89,1,1,1,1,1,0,0,0,0,0,0),
  130.  (0,0,0,0,1,1,1,1,1,89,89,21,89,89,89,89,0,0,0,0,0,0,0,0),
  131.  (0,0,0,0,89,89,21,21,21,89,21,15,89,21,89,89,0,0,0,0,0,0,0,0),
  132.  (0,0,0,89,89,89,21,21,89,89,21,15,89,21,89,89,89,0,0,0,0,0,0,0),
  133.  (0,0,0,89,89,90,21,89,89,89,21,15,89,21,89,89,89,89,89,90,0,0,0,0),
  134.  (0,0,0,89,89,90,21,89,89,89,89,21,89,89,89,89,89,89,89,89,0,0,0,0),
  135.  (0,0,0,0,89,90,89,89,89,21,89,89,90,89,89,21,89,89,89,89,0,0,0,0),
  136.  (0,0,0,0,0,89,89,89,89,21,89,89,89,89,21,21,21,21,21,21,0,0,0,0),
  137.  (0,0,0,0,0,89,89,89,89,89,21,21,21,21,21,21,21,21,0,0,0,0,0,0),
  138.  (0,0,0,0,0,89,89,89,89,89,21,21,21,21,21,21,21,0,0,0,0,0,0,0),
  139.  (0,0,0,0,0,0,89,89,90,89,89,21,21,21,21,0,0,0,0,0,0,0,0,0),
  140.  (0,0,0,0,0,0,0,90,90,90,90,90,90,0,0,0,0,0,0,0,0,0,0,0),
  141.  (0,0,0,0,0,0,0,90,90,90,90,90,90,1,0,0,0,0,0,0,0,0,0,0),
  142.  (0,0,0,0,0,0,4,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0),
  143.  (0,0,0,0,0,4,4,4,4,1,1,1,1,4,0,0,0,0,0,0,0,0,0,0),
  144.  (0,0,0,0,4,4,4,4,4,90,90,90,1,4,4,0,0,0,0,0,0,0,0,0),
  145.  (0,0,0,0,4,4,4,4,4,90,90,90,90,4,4,0,0,0,0,0,0,0,0,0),
  146.  (0,0,0,0,4,4,4,4,4,90,90,90,90,4,90,90,90,0,0,0,0,0,0,0),
  147.  (0,0,0,0,0,4,4,4,4,90,90,90,1,1,0,90,90,0,0,0,0,0,0,0),
  148.  (0,0,0,0,0,1,1,1,1,1,1,15,17,17,15,0,0,0,0,0,0,0,0,0),
  149.  (0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0),
  150.  (0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0),
  151.  (0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0),
  152.  (0,0,0,0,0,0,19,1,1,1,1,1,1,1,19,0,0,0,0,0,0,0,0,0),
  153.  (0,0,0,0,0,0,1,19,1,1,1,1,1,19,19,1,0,0,0,0,0,0,0,0),
  154.  (0,0,0,0,0,0,1,1,19,18,1,1,19,1,1,1,0,0,0,0,0,0,0,0),
  155.  (0,0,0,0,0,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0),
  156.  (0,0,0,0,19,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0),
  157.  (0,0,0,19,19,1,1,1,1,1,0,0,1,1,1,1,1,0,0,0,0,0,0,0),
  158.  (0,0,0,19,19,19,1,1,1,1,0,0,1,1,1,1,1,0,0,0,0,0,0,0),
  159.  (0,0,0,19,19,19,1,1,1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0),
  160.  (0,0,0,19,19,19,19,1,1,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0),
  161.  (0,0,0,19,19,19,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0),
  162.  (0,0,0,19,19,0,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0),
  163.  (0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  164.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  165.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
  166. //********
  167. mar50x24A_3: SpriteType =
  168. ( (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  169.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  170.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  171.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  172.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  173.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  174.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  175.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0),
  176.  (0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0),
  177.  (0,0,0,0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0),
  178.  (0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0),
  179.  (0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0),
  180.  (0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0),
  181.  (0,0,0,0,0,0,0,1,1,1,1,1,1,89,89,89,1,1,1,1,1,0,0,0),
  182.  (0,0,0,0,0,0,0,1,1,1,1,1,89,89,21,89,89,89,89,0,0,0,0,0),
  183.  (0,0,0,0,0,0,0,89,89,21,21,21,89,21,15,89,21,89,89,0,0,0,0,0),
  184.  (0,0,0,0,0,0,89,89,89,21,21,89,89,21,15,89,21,89,89,89,0,0,0,0),
  185.  (0,0,0,0,0,0,89,89,90,21,89,89,89,21,15,89,21,89,89,89,89,89,90,0),
  186.  (0,0,0,0,0,0,89,89,90,21,89,89,89,89,21,89,89,89,89,89,89,89,89,0),
  187.  (0,0,0,0,0,0,0,89,90,89,89,89,21,89,89,90,89,89,21,89,89,89,89,0),
  188.  (0,0,0,0,0,0,0,0,89,89,89,89,21,89,89,89,89,21,21,21,21,21,21,0),
  189.  (0,0,0,0,0,0,0,0,89,89,89,89,89,21,21,21,21,21,21,21,21,0,0,0),
  190.  (0,0,0,0,0,0,0,0,89,89,89,89,89,21,21,21,21,21,21,21,0,0,0,0),
  191.  (0,0,0,0,0,0,0,0,0,89,89,90,89,89,21,21,21,21,0,0,0,0,0,0),
  192.  (0,0,0,0,0,0,0,0,0,0,90,90,90,90,90,90,0,0,0,0,0,0,0,0),
  193.  (0,0,0,0,0,0,0,0,0,0,90,90,90,90,90,90,1,0,0,90,90,0,0,0),
  194.  (0,0,0,0,0,0,0,0,0,1,1,4,4,4,4,1,1,0,0,90,90,90,0,0),
  195.  (0,0,0,0,0,0,0,4,4,1,4,4,4,4,4,4,4,4,4,90,90,90,0,0),
  196.  (0,0,0,0,0,0,0,4,1,1,4,4,4,4,4,4,4,4,4,90,90,90,0,0),
  197.  (0,0,0,0,0,0,4,4,1,1,1,4,4,4,4,4,4,4,4,90,90,0,0,0),
  198.  (0,0,0,0,0,90,4,4,1,1,1,4,4,4,4,4,4,1,0,0,0,0,0,0),
  199.  (0,0,0,0,0,90,4,4,1,1,1,1,4,4,4,4,1,1,0,0,0,0,0,0),
  200.  (0,0,0,0,0,0,0,0,1,1,1,1,4,4,4,4,1,1,0,0,0,0,0,0),
  201.  (0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0),
  202.  (0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0),
  203.  (0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0),
  204.  (0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,18,0,0,0,0,0,0),
  205.  (0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,18,18,1,0,0,0,0,0),
  206.  (0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,18,18,1,1,1,0,0,0,0),
  207.  (0,0,0,19,19,19,0,0,1,1,1,1,1,1,1,18,1,1,1,1,1,0,0,19),
  208.  (0,0,0,19,19,19,1,18,18,1,1,1,1,1,18,18,1,1,1,1,1,1,19,19),
  209.  (0,0,0,19,19,1,1,1,18,18,18,1,1,1,18,1,0,1,1,1,1,1,19,19),
  210.  (0,0,19,19,19,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,19,19),
  211.  (0,0,19,19,19,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,19,19),
  212.  (0,0,19,19,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,19,19),
  213.  (0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,19),
  214.  (0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  215.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  216.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  217.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
  218. //********
  219. mar50x24A_4: SpriteType =
  220. ( (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  221.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  222.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  223.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  224.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  225.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  226.  (0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0),
  227.  (0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0),
  228.  (0,0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0),
  229.  (0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0),
  230.  (0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0),
  231.  (0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0),
  232.  (0,0,0,0,0,1,1,1,1,1,1,89,89,89,1,1,1,1,1,0,0,0,0,0),
  233.  (0,0,0,0,0,1,1,1,1,1,89,89,21,89,89,89,89,0,0,0,0,0,0,0),
  234.  (0,0,0,0,0,89,89,21,21,21,89,21,15,89,21,89,89,0,0,0,0,0,0,0),
  235.  (0,0,0,0,89,89,89,21,21,89,89,21,15,89,21,89,89,89,0,0,0,0,0,0),
  236.  (0,0,0,0,89,89,90,21,89,89,89,21,15,89,21,89,89,89,89,89,90,0,0,0),
  237.  (0,0,0,0,89,89,90,21,89,89,89,89,21,89,89,89,89,89,89,89,89,0,0,0),
  238.  (0,0,0,0,0,89,90,89,89,89,21,89,89,90,89,89,21,89,89,89,89,0,0,0),
  239.  (0,0,0,0,0,0,89,89,89,89,21,89,89,89,89,21,21,21,21,21,21,0,0,0),
  240.  (0,0,0,0,0,0,89,89,89,89,89,21,21,21,21,21,21,21,21,0,0,0,0,0),
  241.  (0,0,0,0,0,0,89,89,89,89,89,21,21,21,21,21,21,21,0,0,0,0,0,0),
  242.  (0,0,0,0,0,0,0,89,89,90,89,89,21,21,21,21,0,0,0,0,0,0,0,0),
  243.  (0,0,0,0,0,0,0,0,90,90,90,90,90,90,0,0,0,0,0,0,0,0,0,0),
  244.  (0,0,0,0,0,0,0,0,90,90,90,90,90,90,0,0,0,0,0,0,0,0,0,0),
  245.  (0,0,0,0,0,0,0,0,1,4,4,4,1,1,1,0,0,0,0,0,0,0,0,0),
  246.  (0,0,0,0,0,0,0,1,1,4,4,4,1,1,4,0,0,0,0,0,0,0,0,0),
  247.  (0,0,0,0,0,0,0,1,1,4,4,4,1,1,4,0,0,0,0,0,0,0,0,0),
  248.  (0,0,0,0,0,0,0,1,1,4,4,4,4,4,4,1,0,0,0,0,0,0,0,0),
  249.  (0,0,0,0,0,0,0,1,1,4,4,4,4,4,4,4,90,0,0,0,0,0,0,0),
  250.  (0,0,0,0,0,0,0,1,1,1,4,4,4,4,4,90,90,90,90,0,0,0,0,0),
  251.  (0,0,0,0,0,0,0,1,1,1,1,4,4,4,90,90,90,90,90,0,0,0,0,0),
  252.  (0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,90,90,90,0,0,0,0,0,0),
  253.  (0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0),
  254.  (0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0),
  255.  (0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,18,0,0,0,0,0,0,0,0),
  256.  (0,0,0,0,0,0,0,1,1,1,1,1,1,1,18,18,1,0,0,0,0,0,0,0),
  257.  (0,0,0,0,0,0,0,1,1,1,1,1,1,18,18,1,1,1,0,0,0,0,0,0),
  258.  (0,0,0,0,0,0,1,1,1,1,1,1,1,18,1,1,1,1,1,0,0,0,0,0),
  259.  (0,0,0,0,0,0,18,1,1,1,1,1,18,18,1,1,1,1,1,1,1,0,0,0),
  260.  (0,0,0,0,1,1,18,18,1,1,1,1,18,1,0,1,1,1,1,1,1,1,0,0),
  261.  (0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,19,19),
  262.  (0,0,19,19,19,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,19,19,19),
  263.  (0,0,19,19,19,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,19,19,19,0),
  264.  (0,0,19,19,19,1,1,1,1,0,0,0,0,0,0,0,0,0,0,19,19,19,0,0),
  265.  (0,0,0,19,19,19,19,1,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0),
  266.  (0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  267.  (0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  268.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  269.  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
  270. //********
  271.  
  272. var
  273.   w, d: integer;
  274.   gd, gm: smallint;
  275.   x, y, i, stlen, index: integer;
  276.   ch: char;
  277.   Info: string;
  278.   MarioIndex: integer;
  279.  
  280.  
  281.   procedure DrawSprite(S: SpriteType; xx, yy: integer);
  282.   var
  283.     r, c: integer;
  284.   begin
  285.     for r := 0 to 49 do
  286.       for c := 0 to 23 do
  287.         if s[r, c] <> 0 then putpixel(xx + c, r + yy, s[r, c]);
  288.   end;
  289.  
  290.   procedure EraseSprite(S: SpriteType; xx, yy: integer);
  291.   var
  292.     r, c: integer;
  293.   begin
  294.     for r := 0 to 49 do
  295.       for c := 0 to 23 do
  296.         if s[r, c] <> 0 then putpixel(xx + c, r + yy, 0);
  297.   end;
  298.  
  299. begin
  300.   gd := vesa;
  301.   Gm := installusermode(800, 600, 256, 1, 8000, 6000);
  302.   randomize;
  303.   InitGraph(gD, gM, '');
  304.  
  305.   info := 'FFFUFFUFDFDFDFFFDFDFFFDFFDFDFFDF';
  306.   stlen := length(info);
  307.  
  308.   w := 24;
  309.   d := 4;
  310.   x := 0;
  311.   y := 400;
  312.  
  313.   setcolor(7);
  314.   marioindex := 0;
  315.  
  316.   for i := 1 to Stlen do
  317.   begin
  318.     rectangle(x, y, x + w, y + d);
  319.     ch := info[i];
  320.     case ch of
  321.       'F': Inc(x, w);
  322.       'U': begin
  323.         Dec(Y, D);
  324.         Inc(x, w);
  325.       end;
  326.       'D': begin
  327.         Inc(Y, D);
  328.         Inc(x, w);
  329.       end;
  330.     end;
  331.   end;
  332.   outtextxy(400, 500, 'Press any key');
  333.   readkey;
  334.   x := 0;
  335.   y := 400;
  336.  
  337.   for i := 1 to Stlen do
  338.   begin
  339.     case marioindex of
  340.       0: drawsprite(mar50x24A_0, x, y - 50);
  341.       1: drawsprite(mar50x24a_1, x, y - 50);
  342.       2: drawsprite(mar50x24a_2, x, y - 50);
  343.       3: drawsprite(mar50x24a_3, x, y - 50);
  344.       4: drawsprite(mar50x24a_4, x, y - 50);
  345.     end;
  346.  
  347.     delay(250);
  348.  
  349.     case marioindex of
  350.       0: erasesprite(mar50x24a_0, x, y - 50);
  351.       1: erasesprite(mar50x24a_1, x, y - 50);
  352.       2: erasesprite(mar50x24a_2, x, y - 50);
  353.       3: erasesprite(mar50x24a_3, x, y - 50);
  354.       4: erasesprite(mar50x24a_4, x, y - 50);
  355.     end;
  356.  
  357.     ch := info[i];
  358.     case ch of
  359.       'F': Inc(x, w);
  360.       'U': begin
  361.         Dec(Y, D);
  362.         Inc(x, w);
  363.       end;
  364.       'D': begin
  365.         Inc(Y, D);
  366.         Inc(x, w);
  367.       end;
  368.     end;
  369.     Inc(marioindex);
  370.     if marioindex > 4 then marioindex := 0;
  371.   end;
  372.  
  373.   drawsprite(mar50x24a_0, x - w, y - 50);
  374.  
  375.   repeat
  376.   until keypressed;
  377.   CloseGraph;
  378. end.
  379.  
  380.  
« Last Edit: May 30, 2025, 06:00:39 pm by TBMan »

TBMan

  • Full Member
  • ***
  • Posts: 194

 

TinyPortal © 2005-2018