if (PerDir = "North"){BombX = PerX;BombY = (PerY - 40);}else if (PerDir = "South"){BombX = PerX;BombY = (PerY + 40);}else if (PerDir = "East"){BombX = (PerX + 40);BombY = PerY;}else if (PerDir = "West"){BombX = (PerX - 40);BombY = PerY;}
if (PerDir == "north")
Example:Code: [Select]if (PerDir == "north")
Another thing: person directions are case sensitive, so you'll need to change the capitalization to "north", "south", "east" and "west", unless you also capitalized the directions in the spriteset file (though this will likely break some default functionality in the map engine).
I suppose this means that I will have to go and change all the directionals in all my spritesets to lowercase...
function convertSprites(){ var to_convert = GetFileList("spritesets"); var temp; for(var i = 0, j = 0; i < to_convert.length; ++i) { if(to_convert[i].slice(to_convert[i].length-5,4)==".rss") { temp = LoadSpriteset(to_convert[i]); for (j = 0; j < temp.directions; ++j) { temp.directions[j].name = temp.directions[j].name.toLowerCase(); } temp.save("../other/" + to_convert[i]); } }}
Notes:1. the converted spritesets will be saved in the folder "other" inside your game's folder the originals won't be overwritten.2. I haven't tested the above but it should work...
Quote from: Rhuan on August 15, 2017, 05:40:01 pmNotes:1. the converted spritesets will be saved in the folder "other" inside your game's folder the originals won't be overwritten.2. I haven't tested the above but it should work...I created an empty project, copied my spritesets into the spriteset folder and executed your code to test it. It did nothing.Tried it in both Sphere 1.5 & miniSphere.I don't have that many spritesets to convert. I'll just go through them and edit them by hand.
let spritesets = from(new DirectoryStream('@/spritesets')) .where(it => it.fileName.endsWith('.rss')) .select(it => ({ fileName: it.fileName, spriteset: LoadSpriteset(it.fullPath) }));for (let it of spritesets) { var convertedName = FS.fullPath(it.fileName, '@/convertedSpritesets'); from(it.spriteset.directions) .each(it => it.name = it.name.toLowerCase()); it.spriteset.save(convertedName);}
@Rhuan It was the only function so I dropped it right into game and attempted it.
Did you check the "other" folder afterwards? It will run very quickly and appear to do almost nothing but all the spritsets with updated names will be saved to the "other" folder and there as soon as sphere exits.
Also Sphere 1.5 or miniSphere?