Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how do i make multiple maps on top of one another?
#1
Hey I am experienting with makeing maps for my rpg inprogress. What i want to do is make it when i pick up a key i will be able to unlock the door but i cant figure out how to make the tile collision go from solid = 2 to solid = 1. this is what i have so far.

Dim guy(50), guysh(50)
Dim sprite1(50), sprite2(50), sprite3(50)
Dim map(27, 27)
Screen 13

guyx = 2
guyy = 2
ldkey = 1

For y = 1 To 5
For x = 1 To 5

READ clr
PSet (x, y), clr

Next: Next
GET (1, 1)-(5, 5), sprite1

For y = 1 To 5
For x = 1 To 5

READ clr
PSet (x, y), clr

Next: Next
GET (1, 1)-(5, 5), sprite2

For y = 1 To 5
For x = 1 To 5

READ clr
PSet (x, y), clr

Next: Next
GET (1, 1)-(5, 5), sprite3




For y = 1 To 5
For x = 1 To 5

READ clr
PSet (x, y), clr

Next: Next
GET (1, 1)-(5, 5), guy

For y = 1 To 5
For x = 1 To 5

READ clr
PSet (x, y), clr

Next: Next
GET (1, 1)-(5, 5), guysh


Cls
For y = 1 To 27
For x = 1 To 27
READ map(x, y)
Next: Next
Cls



For y = 1 To 27
For x = 1 To 27

IF map(x, y) = 1 THEN PUT (x * 5 + 170, y * 5 + 5), sprite1
IF map(x, y) = 2 THEN PUT (x * 5 + 170, y * 5 + 5), sprite2
IF map(x, y) = 3 THEN PUT (x * 5 + 170, y * 5 + 5), sprite3
Next: Next

PUT (guyx * 5 + 170, guyy * 5 + 5), guysh, AND
PUT (guyx * 5 + 170, guyy * 5 + 5), guy, OR



Do
press$ = INKEY$


'IF ldkey >= 1 THEN




IF press$ = CHR$(0) + CHR$(75) THEN map(guyx - 1, guyy) > 1 THEN
guyx = guyx - 1
End If

If press$ = Chr$(0) + Chr$(77) And map(guyx + 1, guyy) > 1 Then
guyx = guyx + 1
End If

If press$ = Chr$(0) + Chr$(72) And map(guyx, guyy - 1) > 1 Then
guyy = guyy - 1
End If

If press$ = Chr$(0) + Chr$(80) And map(guyx, guyy + 1) > 1 Then
guyy = guyy + 1
End If



If oldguyx <> guyx Or oldguyy <> guyy Then
oldguyx = guyx
oldguyy = guyy
For y = 1 To 27
For x = 1 To 27

IF map(x, y) = 1 THEN PUT (x * 5 + 170, y * 5 + 5), sprite1, PSET
IF map(x, y) = 2 THEN PUT (x * 5 + 170, y * 5 + 5), sprite2, PSET
IF map(x, y) = 3 THEN PUT (x * 5 + 170, y * 5 + 5), sprite3, PSET
Next: Next

PUT (guyx * 5 + 170, guyy * 5 + 5), guysh, AND
PUT (guyx * 5 + 170, guyy * 5 + 5), guy, OR


End If



Loop Until press$ = Chr$(27)


Data 8, 8, 5, 8, 8
Data 8, 5, 5, 5, 8
Data 5, 5, 8, 5, 5
Data 8, 5, 5, 5, 8
Data 8, 8, 5, 8, 8

Data 6, 6, 6, 6, 6
Data 6, 6, 6, 6, 6
Data 6, 6, 7, 6, 6
Data 6, 6, 7, 6, 6
Data 6, 6, 6, 6, 6

Data 2, 2, 2, 2, 2
Data 2, 3, 3, 3, 2
Data 2, 3, 3, 3, 2
Data 2, 3, 3, 3, 2
Data 2, 2, 2, 2, 2

Data 0, 0, 4, 0, 0
Data 0, 4, 4, 4, 0
Data 4, 4, 4, 4, 4
Data 0, 4, 4, 4, 0
Data 0, 0, 4, 0, 0

Data 255, 255, 4, 255, 255
Data 255, 4, 4, 4, 255
Data 4, 4, 4, 4, 4
Data 255, 4, 4, 4, 255
Data 255, 255, 4, 255, 255

Data 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Data 1, 3, 3, 3, 3, 1, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 1
Data 1, 3, 1, 1, 1, 1, 3, 3, 1, 3, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 1, 1, 1, 1, 3, 1
Data 1, 3, 1, 1, 1, 1, 1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 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1
Data 1, 3, 1, 3, 1, 1, 3, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1, 1, 1, 3, 1
Data 1, 3, 1, 3, 1, 1, 3, 1, 3, 3, 3, 1, 3, 1, 3, 3, 3, 3, 1, 3, 1, 3, 1, 1, 1, 2, 1
Data 1, 3, 1, 3, 1, 1, 3, 1, 3, 3, 3, 1, 1, 1, 3, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 1
Data 1, 2, 1, 3, 1, 1, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 3, 1
Data 1, 3, 1, 3, 1, 1, 3, 3, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 3, 3, 3, 1
Data 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 1, 1, 3, 1
Data 1, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 1, 3, 1, 1, 1, 1, 3, 1, 3, 1, 3, 3, 1
Data 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1, 1
Data 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 3, 1, 1, 3, 1, 3, 1, 1, 1, 1
Data 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 2, 3, 3, 3, 1
Data 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1

this is just a map 2 look at like a visual to see the dungen that you are in. can anybody help or pint me to a tutorial on this subject. thanks.
ife is better with a buistcuit
Reply
#2
So you use your map array to determine if a something is "walkable" or not....
I would do it by making an extra array for that,so you can change it very easy from 0 (walkable) to 1 (not walkable) or vice versa...
B 4 EVER
Reply
#3
Try using a TYPE array for the tiles, that's what I do, and it's more organized. For your maps, you can do something like what I do.
My maps are formated just like my graphic tiles, each pixel
on the map represents a tile, and each pixels color value is associated with the data of the same TYPE array (index).
For example, if my map is 60X60 tiles, I simply draw (in my favorite sprite editor) a 60X60 sprite. And say, a green pixel, (color2) would represent whatever info the TYPE array(2) is holding, let's assume it's a grass tile and it's also a walkable tile. Then a brown pixel, (color 6) would be something like the ground tile and it would also be walkable. A grey pixel, (color 7) could be a stone or rock tile, and it would be a non-walkable tile.
Now for maps with multiple layeres you just make a multi-framed tile, just like making an animated sprite.
Doing it this way, and using colors that match or resemble the colors and types of your tiles, you can easily make maps without a map editor. For example, I use PP256, for my TILES, SPRITES,
and MAPS!
If you need a better explaination or some code and examples,
just let me know and I'll try to help you more.

Cya!
Reply
#4
yeah, you can do it like this:
Code:
TYPE TMap
layer0 AS INTEGER
layer1 AS INTEGER
layer2 AS INTEGER
walkAble AS INTEGER
END TYPE

DIM SHARED Map(50, 50) AS TMap
B 4 EVER
Reply
#5
thanks i will try that. i actually understand that. :bounce:
ife is better with a buistcuit
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)