@
Quxios sorry for creating confusion.
I sort of kinda fixed the door... it works ok for me, as a normal event, I try to stay away from Qmap. Not sure exactly what QMap is good for me, however I like the fact I can use the half transparency trick when behind the objects, but that is all.
But now I'm talking about creating collision maps for the maps in the game. I know I can use a white/red color map for example, but you said in the docs that using polygons should be much faster, less computations.
I found an "easy" way to create polygons, I just make some paths in Photoshop then I run a script to process the paths and give me all coordinates.
So, is it possible to use a polygon (actually multiple polygons) for a map instead of images in QM+CollisionMap.js ???
For reference this is the script I'm using to quickly get the poly coordinates:
Code:
#target photoshop
//original script here: https://github.com/pdizz/Photoshop-Scripts/blob/master/get%20selection%20coordinate%20points.jsx
// Save the current unit preferences (optional)
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
// Set units to PIXELS
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
// Use the top-most document
var doc = app.activeDocument;
var width = parseInt(app.activeDocument.width.toString().replace(' px', ''));
var height = parseInt(app.activeDocument.height.toString().replace(' px', ''));
var paths = app.activeDocument.pathItems;
var pathsLength = paths.length;
var coords = new File("~/Desktop/coords.txt");
coords.open("w");
for(var i = 0; i < pathsLength; i++)
{
var wPath = doc.pathItems[paths[i].name];
var stride = 1; // 2 means every 2nd, 3 means every 3rd, etc. Minimum 1
coords.writeln(paths[i].name);
coords.write('<collider:poly');
// Loop through all path points and add their anchor coordinates to the output text
for (var j=0; j<wPath.subPathItems[0].pathPoints.length; j++) {
if (j % stride === 0) {
//alert(wPath.subPathItems[0].pathPoints[j].anchor);
var anchor_string = wPath.subPathItems[0].pathPoints[j].anchor+'';
var anchor_xy = anchor_string.split(',');
//for map use this
var anchor_x = parseInt(anchor_xy[0]);
var anchor_y = parseInt(anchor_xy[1]);
//for events with offsets use this
//var anchor_x = parseInt(anchor_xy[0]) - (width/2-24);
//var anchor_y = parseInt(anchor_xy[1]) - (height-48);
coords.write(',('+anchor_x+','+anchor_y+')');
}
}
coords.write('>\n');
}
coords.close();
// Alert the output text
alert(coords);
// Reset to previous unit prefs (optional)
app.preferences.rulerUnits = startRulerUnits;
app.preferences.typeUnits = startTypeUnits;