Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SUB redot.screen2
- 'ouch, i hate explaining this, but here goes...
- 'This map engine uses a text map...each time the game loops, it gos in
- 'here to read from the map, it gos through the map scanning it for certain
- 'letters, and based on those letters, it PUTs a sprite on the screen.
- 'now, in order for these sprites to be put on the screen,
- 'you must make your map variables somehow be useable by the screen variables.
- 'i pondered this for a while, and came up with this:
- FOR re = scr.sizex TO scr.sizey 'okay starting at say..
- 'mid$(map$(x-3),y) and reading all the way to mid$(map$(x+3),y)
- 'this reads a total of 7 " "'s or (i call these squares) including x(0),y
- FOR ce = scr.sizex TO scr.sizey
- '/\---this does the same except to the y or(column) variable.
- 'okay..if that didnt help at all, keep everything i said
- 'in mind and ill continue to explain it..this:
- 'the following variables were just calculated above with
- 'the FOR statement..now we are going to use the following
- 'values to explain the next block of code.
- 'just keep reading.....that is the best way to understand it:
- 'x=13
- 'y=14
- 'mid$(map$(x-3),y+4,1) <---------------------------------------\
- 'that would take the current spot on the map to:x=10;y=18 |
- 'so that's like saying mid$(map$(10), 18, 1) |
- 'now comes the part where the sprite is put on the screen... |
- 'and that is where these variables below come in |
- 'look at this line of code: |
- 'PUT (ce+12*10,cy+8*10), sprite |
- 'is the same as (using the values i showed before) <-----------/
- 'PUT (-3+8*10,4+12*10), sprite
- 'is the same as:
- 'PUT (50,160), sprite
- 'youll note that in teh following line it checks for a certain letter
- 'or number and then puts a different sprite accordingly.
- 'so you'd get something like this:
- 'if mid$(map$(13-3),14+4, 1) = "s" THEN PUT (50,160), stairs, PSET
- 'or if you really simplify it:
- 'if mid$(map$(10), 18, 1) = "s" THEN PUT (50,160), stairs, PSET
- 'only its all variables, and its all confusing
- 'now as you may also notice, there's another little thing i added in
- 'i added a little +5 in the PUT statements. Don't worry about them,
- 'they are useless, and can be taken out as a matter of fact!
- 'I hope you get it! If you dont plz ask me what you dont get.
- 'cx = re + 8
- 'cy = ce + 12
- cx = re + 4
- cy = ce + 6
- 'PRINT x
- 'PRINT y
- 'PRINT re
- 'PRINT ce
- 'PRINT cy
- 'PRINT cx
- IF MID$(map$(x + re), y + ce, 1) = " " THEN PUT (cy * 20 + 5, cx * 20), ogrnd%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "." THEN PUT (cy * 20 + 5, cx * 20), ogrnd2%, PSET: GOTO the123:
- 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:
- 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:
- 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:
- 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:
- 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
- IF MID$(map$(x + re), y + ce, 1) = CHR$(1) THEN PUT (cy * 20 + 5, cx * 20), enemy%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "g" THEN PUT (cy * 20 + 5, cx * 20), jwl%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "s" THEN PUT (cy * 20 + 5, cx * 20), dwn%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "u" THEN PUT (cy * 20 + 5, cx * 20), up%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = CHR$(2) THEN PUT (cy * 20 + 5, cx * 20), player%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "k" THEN PUT (cy * 20 + 5, cx * 20), king%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "0" THEN PUT (cy * 20 + 5, cx * 20), tp%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "9" THEN PUT (cy * 20 + 5, cx * 20), tp%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "d" THEN PUT (cy * 20 + 5, cx * 20), door%, PSET: GOTO the123:
- '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:
- IF MID$(map$(x + re), y + ce, 1) = "t" THEN PUT (cy * 20 + 5, cx * 20), tree%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "b" THEN PUT (cy * 20 + 5, cx * 20), dgrnd%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "a" THEN PUT (cy * 20 + 5, cx * 20), player%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "r" THEN PUT (cy * 20 + 5, cx * 20), roof%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "Q" THEN PUT (cy * 20 + 5, cx * 20), smoke1%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "1" THEN PUT (cy * 20 + 5, cx * 20), innn%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "2" THEN PUT (cy * 20 + 5, cx * 20), thouse%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "3" THEN PUT (cy * 20 + 5, cx * 20), thealer%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "4" THEN PUT (cy * 20 + 5, cx * 20), tbsmith%, PSET: GOTO the123:
- IF MID$(map$(x + re), y + ce, 1) = "5" THEN PUT (cy * 20 + 5, cx * 20), tarmor%, PSET
- the123:
- NEXT
- NEXT
- END SUB
Add Comment
Please, Sign In to add comment