forums

TNT Basic Forums > Programming Q&A
Map Layers?
< Last Thread     Next Thread >
Author
Thread        Post A Reply

08-15-2003 17:12

Posted by:
Zip

Click Here to Email Zip   Find more posts by Zip

How do i create multiple layers in maps and how do i manipulate them?

08-15-2003 20:24

Posted by:
CubeFusion

Location:
California, USA

Find more posts by CubeFusion

Simple. You can't do it with the way maps currently work. Although that limitation can be worked around if you build a map out of sprites. Otherwise it is impossible at the moment.

08-16-2003 11:51

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

A work around may be to use multiple viewports, but I don't know how this will fit in with what you have in mind.

08-16-2003 14:48

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

If you want multiple layers to overlay with no parrallax ( parralax means all layers do not scroll at the same speed ) you can use a canvas and draw all leyrs on the top of the others. If you want parallax, check the example at: http://TNTbasic_files.site.voila.fr/

08-16-2003 21:24

Posted by:
Zip

Click Here to Email Zip   Find more posts by Zip

Ok, So I assume that whenever you need to reference a layer you use 0?
In Map Polygon for example needs a layer to be passed to it.

08-17-2003 13:57

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Unless you have many layers. The other layers, in most cases, are not used to be displayed. You can store the places where you can't go, the secret passages, etc. that aren't displayed but are necessary.

08-17-2003 17:44

Posted by:
Zip

Click Here to Email Zip   Find more posts by Zip

Ok here is my problem. for some reason the Canmoveto code isn't working, when you press the left key the sprite just stays put. the other keys work.

graphics mode 640,480
load map 129
global int base
global int XX
global int XY
global int can = 0
base = 32
XX = base * 3
XY = base * 2

'make the character sprite
Draw Map Section 0,0 to 640,480,0 to 0,0
Copy Image 0,0,32,32,white,false to 0,130

'draw the map
load images 130
load map 128
Draw Map Section 0,0 to 640,480,0 to 0,0

' Draw the sprite at starting position
sprite 0,XX, XY, 0

while not mouse button
if pressed(123)
Move("left")
end if
if pressed(124)
Move("right")
end if
if pressed(126)
Move("up")
end if
if pressed(125)
Move("down")
end if
draw frame
wend

Procedure Move(string direction)
if direction = "left"
Canmoveto(XX - base, XY)
if can = 1
Draw Map Section 0,0 to 640,480,0 to 0,0
sprite 0,XX - base, XY, 0
XX = XX - base
can = 0
end if
end if

if direction = "right"
Draw Map Section 0,0 to 640,480,0 to 0,0
sprite 0,XX + base, XY, 0
XX = XX + base
end if

if direction = "up"
Draw Map Section 0,0 to 640,480,0 to 0,0
sprite 0,XX, XY - base, 0
XY = XY - base
end if

if direction = "down"
Draw Map Section 0,0 to 640,480,0 to 0,0
sprite 0,XX, XY + base, 0
XY = XY + base
end if
end proc

Procedure Canmoveto(int X, int Y) 'checks if the coords specified are in polygon 1(walkable)
if In Map Polygon(1, X, Y, 0) = true
can = 1
end if
end proc



I only used the Canmoveto code with the left key, i will add it to the rest once i get it working.

08-17-2003 19:47

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

quote:
Procedure Canmoveto(int X, int Y) 'checks if the coords specified are in polygon 1(walkable)
if In Map Polygon(1, X, Y, 0) = true
can = 1
end if
end proc



Make sure you are passing tile coordinates to "in map polygon", not pixel coordinates

08-17-2003 23:23

Posted by:
Zip

Click Here to Email Zip   Find more posts by Zip

Oh! Thanks ill try that once i get on the TNT computer.

08-19-2003 15:51

Posted by:
Zip

Click Here to Email Zip   Find more posts by Zip

Nope

Still doesn't work, my tiles are 32/32 so i divided the destination cordinates by 32 before passing them to Canmoveto.

08-19-2003 21:23

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

I think there was an issue about map polygon, and the choords weren't in the good order in the documentation. Try this:

> in map polygon(x,y,layer,polygonID)

( I never tried it )

08-20-2003 05:29

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

Oh yeah, that's right, I was the one who figured it out! :) Forgot I had trouble with it.

quoting myself:

quote:
I think I've got it!

The help guide gives the wrong syntax. It says "in map polygon(polygonID, x,y, layer)". Try putting the polygon ID last, like this: "in map polygon(x,y,layer,polygonID)"



I checked the thread and no one from the TNT staff said anything. Perhaps they didn't notice the thread. I'll put a note in the "bugs" forum.

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.