Skip to content

Problem with args.Player.Teleport #2102

Answered by Quinci135
LuanIllogical asked this question in Q&A
Discussion options

You must be logged in to vote

Tile coordinates are 1/16 of world coordinates (each tile is 16x16 pixels)
So you would be teleporting 472 pixels right 111 pixels down from the top left corner of the world (not very far)
https://github.com/tModLoader/tModLoader/wiki/Basic-Tile#coordinates

Multiply both coordinates by 16 to get world coordinates (by whole tile instead of pixels) which is used for npcs, players, and projectiles which you use for args.Player.Teleport()
eg args.Player.Teleport(X * 16, Y * 16, 1);

Had to do that to teleport a player to wherever they pinged on the map
https://github.com/Quinci135/MapTeleport/blob/master/MapTeleport/MapTeleport.cs#L55

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@LuanIllogical
Comment options

@LuanIllogical
Comment options

Answer selected by LuanIllogical
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants