SetGearPosition Question

5 replies [Last post]
francot514
User offline. Last seen 2 years 4 weeks ago. Offline
Joined: 2015-03-20
Posts: 163

Hi, i want to ask something about the map coordinates plane, can you explain me where is the origin, and how much ( in pixels) increase by X, Y the coordinate.

Im trying to use this function, but always fail to calculate the coords properly..

sheepluva
sheepluva's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2009-07-18
Posts: 563

0,0 is at the TOP LEFT of the map.
X increases to the right.
Y increases downwards (towards waterline)

The coordinates are in pixels (as in map pixels).

Try this:

    * Start a local game (e.g. a quick game).
    * Wait until the first turn starts and press P to pause the game
    * In chat enter /lua to enter lua-parsing mode
    * Then in chat enter x,y = GetGearPosition(CurrentHedgehog) AddCaption("Current Hedgehog X=" .. x .. " Y=" ..y)

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

francot514
User offline. Last seen 2 years 4 weeks ago. Offline
Joined: 2015-03-20
Posts: 163

sheepluva allegedly wrote:

0,0 is at the TOP LEFT of the map.
X increases to the right.
Y increases downwards (towards waterline)

The coordinates are in pixels (as in map pixels).

Based on this the higher X, Y possible are the dimensions of the map (most cases 2048 x 1024)??

nemo
nemo's picture
User offline. Last seen 21 weeks 1 day ago. Offline
Joined: 2009-01-28
Posts: 1861

francot514 allegedly wrote:

sheepluva allegedly wrote:

0,0 is at the TOP LEFT of the map.
X increases to the right.
Y increases downwards (towards waterline)

The coordinates are in pixels (as in map pixels).

Based on this the higher X, Y possible are the dimensions of the map (most cases 2048 x 1024)??

these days most of the time the map is 4096x2048

but. you can place things at negative coordinates too. this just won't work for things that require solidity. like placing a girder.

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

francot514
User offline. Last seen 2 years 4 weeks ago. Offline
Joined: 2015-03-20
Posts: 163

Ok, i get it and now i know how to magange for default map sizes 2048x1024, will look for higher resolutions..

nemo
nemo's picture
User offline. Last seen 21 weeks 1 day ago. Offline
Joined: 2009-01-28
Posts: 1861

FWIW, at present, the maximum width of an image map is 16,384 and the maximum height is 65,536.

http://hedgewars.org/kb/PresetMaps has more information on image maps.

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]