Forum

> > CS2D > Scripts > how i can know the y and x in map ?
Forums overviewCS2D overview Scripts overviewLog in to reply

English how i can know the y and x in map ?

8 replies
To the start Previous 1 Next To the start

old Re: how i can know the y and x in map ?

EP
User Off Offline

Quote
Let's say you have to teleport to that red tile:
IMG:https://screenshooter.net/data/uploads/sh/cb/yduy.jpg


Its coordinates (in tiles) is X=12 and Y=7:
IMG:https://screenshooter.net/data/uploads/ld/hk/wjss.jpg


In CS2D a tile is 32 pixels width and 32 pixels height. So that means a tile is 32x32. To convert these tile coordinates to pixel coordinates that we got before, you have to multiply them by 32.

X = 12 (Tiles) X = 12*32 (Pixels) X = 384
Y = 7 (Tiles) Y = 7*32 (Pixels) Y = 224

old Re: how i can know the y and x in map ?

Avo
User Off Offline

Quote
You can also use this:
1
2
3
4
5
6
7
8
addhook("say", "OnSay")
OnSay = function(id, txt)
	if txt == "!pos" then
		local POS = "Your position is: X = "..player(id, "x").."("..player(id, "tilex").."), Y = "..player(id, "y").."("..player(id, "tiley")..")"
		msg2(id, POS)
		return 1
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview