daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Oct 28th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SUB redot.screen2
  2. 'ouch, i hate explaining this, but here goes...
  3.  
  4. 'This map engine uses a text map...each time the game loops, it gos in
  5. 'here to read from the map, it gos through the map scanning it for certain
  6. 'letters, and based on those letters, it PUTs a sprite on the screen.
  7.  
  8. 'now, in order for these sprites to be put on the screen,
  9. 'you must make your map variables somehow be useable by the screen variables.
  10. 'i pondered this for a while, and came up with this:
  11.  
  12.  
  13. FOR re = scr.sizex TO scr.sizey 'okay starting at say..
  14.  
  15.    'mid$(map$(x-3),y) and reading all the way to mid$(map$(x+3),y)
  16.    'this reads a total of 7 " "'s or (i call these squares) including x(0),y
  17.  
  18. FOR ce = scr.sizex TO scr.sizey
  19.    '/\---this does the same except to the y or(column) variable.
  20.  
  21.  
  22.  
  23. 'okay..if that didnt help at all, keep everything i said
  24. 'in mind and ill continue to explain it..this:
  25. 'the following variables were just calculated above with
  26. 'the FOR statement..now we are going to use the following
  27. 'values to explain the next block of code.
  28. 'just keep reading.....that is the best way to understand it:
  29. 'x=13
  30. 'y=14
  31. 'mid$(map$(x-3),y+4,1) <---------------------------------------\
  32. 'that would take the current spot on the map to:x=10;y=18      |
  33. 'so that's like saying mid$(map$(10), 18, 1)                   |
  34. 'now comes the part where the sprite is put on the screen...   |
  35. 'and that is where these variables below come in               |
  36. 'look at this line of code:                                    |
  37. 'PUT (ce+12*10,cy+8*10), sprite                               |
  38. 'is the same as (using the values i showed before) <-----------/
  39. 'PUT (-3+8*10,4+12*10), sprite
  40. 'is the same as:
  41. 'PUT (50,160), sprite
  42. 'youll note that in teh following line it checks for a certain letter
  43. 'or number and then puts a different sprite accordingly.
  44. 'so you'd get something like this:
  45.  
  46. 'if mid$(map$(13-3),14+4, 1) = "s" THEN PUT (50,160), stairs, PSET
  47. 'or if you really simplify it:
  48. 'if mid$(map$(10), 18, 1) = "s" THEN PUT (50,160), stairs, PSET
  49.  
  50. 'only its all variables, and its all confusing
  51.  
  52. 'now as you may also notice, there's another little thing i added in
  53. 'i added a little +5 in the PUT statements. Don't worry about them,
  54. 'they are useless, and can be taken out as a matter of fact!
  55.  
  56. 'I hope you get it! If you dont plz ask me what you dont get.
  57.  
  58. 'cx = re + 8
  59. 'cy = ce + 12
  60. cx = re + 4
  61. cy = ce + 6
  62. 'PRINT x
  63. 'PRINT y
  64. 'PRINT re
  65. 'PRINT ce
  66. 'PRINT cy
  67. 'PRINT cx
  68.  
  69. IF MID$(map$(x + re), y + ce, 1) = " " THEN PUT (cy * 20 + 5, cx * 20), ogrnd%, PSET: GOTO the123:
  70. IF MID$(map$(x + re), y + ce, 1) = "." THEN PUT (cy * 20 + 5, cx * 20), ogrnd2%, PSET: GOTO the123:
  71. IF lvl <> 1 AND lvl < 6 THEN IF MID$(map$(x + re), y + ce, 1) = "w" THEN PUT (cy * 20 + 5, cx * 20), wall%, PSET: GOTO the123:
  72.  IF lvl = 1 OR lvl > 5 THEN IF MID$(map$(x + re), y + ce, 1) = "w" THEN PUT (cy * 20 + 5, cx * 20), wall2%, PSET: GOTO the123:
  73.  IF lvl <> 1 AND lvl < 6 THEN IF MID$(map$(x + re), y + ce, 1) = "f" THEN PUT (cy * 20 + 5, cx * 20), wall%, PSET: GOTO the123:
  74.  IF lvl = 1 OR lvl > 5 THEN IF MID$(map$(x + re), y + ce, 1) = "f" THEN PUT (cy * 20 + 5, cx * 20), wall2%, PSET: GOTO the123:
  75. IF MID$(map$(x + re), y + ce, 1) = "e" THEN MID$(map$(x + re), y + ce, 1) = CHR$(1): sel = sel + 1: ex(sel) = re + x: ey(sel) = ce + y: make: MID$(map$(re + x), ce + y, 1) = " ": wernshmetzer = 1: detect: redot.screen2
  76. IF MID$(map$(x + re), y + ce, 1) = CHR$(1) THEN PUT (cy * 20 + 5, cx * 20), enemy%, PSET: GOTO the123:
  77. IF MID$(map$(x + re), y + ce, 1) = "g" THEN PUT (cy * 20 + 5, cx * 20), jwl%, PSET: GOTO the123:
  78. IF MID$(map$(x + re), y + ce, 1) = "s" THEN PUT (cy * 20 + 5, cx * 20), dwn%, PSET: GOTO the123:
  79. IF MID$(map$(x + re), y + ce, 1) = "u" THEN PUT (cy * 20 + 5, cx * 20), up%, PSET: GOTO the123:
  80. IF MID$(map$(x + re), y + ce, 1) = CHR$(2) THEN PUT (cy * 20 + 5, cx * 20), player%, PSET: GOTO the123:
  81. IF MID$(map$(x + re), y + ce, 1) = "k" THEN PUT (cy * 20 + 5, cx * 20), king%, PSET: GOTO the123:
  82. IF MID$(map$(x + re), y + ce, 1) = "0" THEN PUT (cy * 20 + 5, cx * 20), tp%, PSET: GOTO the123:
  83. IF MID$(map$(x + re), y + ce, 1) = "9" THEN PUT (cy * 20 + 5, cx * 20), tp%, PSET: GOTO the123:
  84. IF MID$(map$(x + re), y + ce, 1) = "d" THEN PUT (cy * 20 + 5, cx * 20), door%, PSET: GOTO the123:
  85. 'IF MID$(map$(x + re), y + ce, 1) = "t" THEN PUT (cy * 20 + 5, cx * 20), ogrnd%, PSET: PUT (cy * 20 + 5, cx * 20), tree%, OR: GOTO the123:
  86. IF MID$(map$(x + re), y + ce, 1) = "t" THEN PUT (cy * 20 + 5, cx * 20), tree%, PSET: GOTO the123:
  87. IF MID$(map$(x + re), y + ce, 1) = "b" THEN PUT (cy * 20 + 5, cx * 20), dgrnd%, PSET: GOTO the123:
  88. IF MID$(map$(x + re), y + ce, 1) = "a" THEN PUT (cy * 20 + 5, cx * 20), player%, PSET: GOTO the123:
  89. IF MID$(map$(x + re), y + ce, 1) = "r" THEN PUT (cy * 20 + 5, cx * 20), roof%, PSET: GOTO the123:
  90. IF MID$(map$(x + re), y + ce, 1) = "Q" THEN PUT (cy * 20 + 5, cx * 20), smoke1%, PSET: GOTO the123:
  91.                                                                                          
  92. IF MID$(map$(x + re), y + ce, 1) = "1" THEN PUT (cy * 20 + 5, cx * 20), innn%, PSET: GOTO the123:
  93. IF MID$(map$(x + re), y + ce, 1) = "2" THEN PUT (cy * 20 + 5, cx * 20), thouse%, PSET: GOTO the123:
  94. IF MID$(map$(x + re), y + ce, 1) = "3" THEN PUT (cy * 20 + 5, cx * 20), thealer%, PSET: GOTO the123:
  95. IF MID$(map$(x + re), y + ce, 1) = "4" THEN PUT (cy * 20 + 5, cx * 20), tbsmith%, PSET: GOTO the123:
  96. IF MID$(map$(x + re), y + ce, 1) = "5" THEN PUT (cy * 20 + 5, cx * 20), tarmor%, PSET
  97. the123:
  98. NEXT
  99. NEXT
  100.  
  101. END SUB
RAW Paste Data
Top