Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
For example Place an Event001 in the Top Left corner of your huge scrollable map.
Now lets change your math for detection of coordinates.
Var1 = Event001 ScreenX
Var2 = Event001 ScreenY
Var1 - ScreenX of your Mouseclick
for the rest of the math its too late this night....
But that Event allows you to have Screencoordinates to compare with....
Hopes this helps towards correct direction.
Hey,
sorry for the delayed answer, went straight to bed afterwards.
Good thinking! I had a similar thought this morning and it actually works.
For those interested basically do the following:
Place an event on top left corner of the map (Tile = (0,0)). This event needs to take its screen X and Y in two separate variables. If you have the screen position, divide the x value by 48 (and floor it if you want to be safe). Take the abs as it is easier to comprehend for later math.
1) Math.abs(Math.floor($gameVariables.value(YourEventsScreenX)/48))
Of course we need this for Y, too.
After this take your touch/mouse input regularly where ever you need it with
2) TouchInput._x and TouchInput._y
In the last step transform the TouchInput to coordinates as seen in 1) then just add your offset.
3)
// Get touchinput screen coordinates as var x and y and transform them to tilescoordinates
var x = Math.floor($gameVariables.value(1)/48);
var y = Math.floor($gameVariables.value(2)/48);
// add screen offset variables (offsetX = 248 / offsetY = 249)
x = x + $gameVariables.value(248);
y = y + $gameVariables.value(249);
// store it
$gameVariables.setValue(3, x);
$gameVariables.setValue(4, y);
=> Provided Variable 1 = TouchInput._x and Variable 2 = TouchInput._y, as well as Variable 248 = offsetX (the one calculated with the helper event) and Variable 249 = offsetY you get
Variable 3 = ClickedTileX and Variable 4 = ClickedTileY.
Maybe this will help someone in the future, and thanks again for the fast response :)