Author Topic: ASCII Animation Code | Not efficient but easy and informative  (Read 3492 times)

0 Members and 1 Guest are viewing this topic.

Offline Virtusoroca

  • Newbie
  • Posts: 24
    • View Profile
To be integrated in ASCII Terrain Egine 1.3

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 800, 256)
  2.  
  3. PRINT "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»"
  4. PRINT "º ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ      ASCII TERRAIN ENGINE     ÛÛßßÛÛ ÛÛßßÛÛ º"
  5. PRINT "º ÛÛ     Û     ÛÛ      ® Animation Module ¯     ÛÛ ÞÛÛ ÛÛÛÛÛ  º"
  6. PRINT "º ÛÛ  Û  Û  Û  ÛÛ  (to be integreated in v.1.3) ÛÛÜÞÛÛ ÛÛÜÜÛÛ º"
  7. PRINT "º    Û  Û  Û    Not efficient but informative   ßß          º"
  8. PRINT "º ÛÛ  Û  Û  Û  ÛÛ          ------------         ÛÛßßßß ÛÛ  ÛÛ º"
  9. PRINT "º ÛÛ  Û     Û  ÛÛ  By Virtusoroca-Brazil, 2020  ÛÛßßÛÛ ÛÛÜÜÛÛ º"
  10. PRINT "º ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ          Made in QB64         ÛÛÜÜÛÛ     ÛÛ º"
  11. PRINT "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ"
  12.  
  13. TYPE Players: x AS INTEGER: y AS INTEGER: END TYPE
  14. DIM SHARED Player(1) AS Players
  15. DIM SHARED KeyPress AS STRING
  16. Player(1).x = 25: Player(1).y = 40
  17.  
  18. DO UNTIL KeyPress = "Q"
  19.     _LIMIT 30
  20.     KeyPress = UCASE$(INKEY$)
  21.     PCOPY _DISPLAY, 1
  22.     MovePlayer
  23.     CheckLimit
  24.     _DISPLAY
  25.     PCOPY 1, _DISPLAY
  26.  
  27.  
  28. SUB MovePlayer
  29.     SELECT CASE KeyPress
  30.         CASE CHR$(0) + CHR$(72): Player(1).x = Player(1).x - 1: IF (Player(1).x MOD 2) = 0 THEN FrameU1: ELSE FrameU2
  31.         CASE CHR$(0) + CHR$(80): Player(1).x = Player(1).x + 1: IF (Player(1).x MOD 2) = 0 THEN FrameD1: ELSE FrameD2
  32.         CASE CHR$(0) + CHR$(75): Player(1).y = Player(1).y - 1: IF (Player(1).y MOD 2) = 0 THEN FrameL1: ELSE FrameL2
  33.         CASE CHR$(0) + CHR$(77): Player(1).y = Player(1).y + 1: IF (Player(1).y MOD 2) = 0 THEN FrameR1: ELSE FrameR2
  34.         CASE "": FrameS
  35.     END SELECT
  36.  
  37.  
  38. SUB FrameS 'STILL
  39.     LOCATE Player(1).x + 0, Player(1).y: PRINT " þ "
  40.     LOCATE Player(1).x + 1, Player(1).y: PRINT "³Û³"
  41.     LOCATE Player(1).x + 2, Player(1).y: PRINT " º "
  42. SUB FrameU1 'UP
  43.     LOCATE Player(1).x + 0, Player(1).y: PRINT " þ|"
  44.     LOCATE Player(1).x + 1, Player(1).y: PRINT "³° "
  45.     LOCATE Player(1).x + 2, Player(1).y: PRINT " Þ "
  46. SUB FrameU2 'UP
  47.     LOCATE Player(1).x + 0, Player(1).y: PRINT "|þ "
  48.     LOCATE Player(1).x + 1, Player(1).y: PRINT " °³"
  49.     LOCATE Player(1).x + 2, Player(1).y: PRINT " Ý ":
  50. SUB FrameD1 'DOWN
  51.     LOCATE Player(1).x + 0, Player(1).y: PRINT " þ "
  52.     LOCATE Player(1).x + 1, Player(1).y: PRINT "|Û "
  53.     LOCATE Player(1).x + 2, Player(1).y: PRINT " Þ "
  54. SUB FrameD2 'DOWN
  55.     LOCATE Player(1).x + 0, Player(1).y: PRINT " þ "
  56.     LOCATE Player(1).x + 1, Player(1).y: PRINT " Û|"
  57.     LOCATE Player(1).x + 2, Player(1).y: PRINT " Ý "
  58. SUB FrameL1 'LEFT
  59.     LOCATE Player(1).x + 0, Player(1).y: PRINT " þ "
  60.     LOCATE Player(1).x + 1, Player(1).y: PRINT ".Û "
  61.     LOCATE Player(1).x + 2, Player(1).y: PRINT " Ý\"
  62. SUB FrameL2 'LEFT
  63.     LOCATE Player(1).x + 0, Player(1).y: PRINT " þ "
  64.     LOCATE Player(1).x + 1, Player(1).y: PRINT " Û "
  65.     LOCATE Player(1).x + 2, Player(1).y: PRINT "<Þ"
  66. SUB FrameR1 'RIGHT
  67.     LOCATE Player(1).x + 0, Player(1).y: PRINT " þ "
  68.     LOCATE Player(1).x + 1, Player(1).y: PRINT " Û."
  69.     LOCATE Player(1).x + 2, Player(1).y: PRINT "/Þ "
  70. SUB FrameR2 'RIGHT
  71.     LOCATE Player(1).x + 0, Player(1).y: PRINT " þ "
  72.     LOCATE Player(1).x + 1, Player(1).y: PRINT " Û "
  73.     LOCATE Player(1).x + 2, Player(1).y: PRINT " Ý>"
  74.  
  75.  
  76. SUB CheckLimit
  77.     IF Player(1).x <= 2 THEN Player(1).x = 2
  78.     IF Player(1).x >= 45 THEN Player(1).x = 45
  79.     IF Player(1).y <= 2 THEN Player(1).y = 2
  80.     IF Player(1).y >= 85 THEN Player(1).y = 85
ASCII_animation_code.jpg
* ASCII_animation_code.jpg (Filesize: 234.41 KB, Dimensions: 915x723, Views: 311)