Thanks
(Have you fixed it for surface.cloneSection as well as Surface#cloneSection?)
Couple of things I'd like to query:
1. Can you sell me on Sphere version2 - I'm still not sure what I think of it from the things you've said, I love the increased speed of miniSphere over 1.5 for most things, but can't currently see any significant benefits to changing API, I'm open to being persuaded though... I'm particularly interested in:
- understanding how Galileo is meant to work - my current graphics activities involve a lot of odd stuff - the code base for my current project uses quite a few graphics primitives and lots of zoomBlit and transformBlitMask in order to get the sort of graphical functions I want.
- Understanding what benefit the Dispatch API would have over the while loop of nested switch statements that I use - if any, with my loop everything is set up in order, and the switch statements ensure that the correct state is maintained and the correct actions happen, would Dispatch simplify this somehow? Could it be faster? i.e. instead of changing a state variable so the next iteration of the loop drops into a different case, I'd cancel one recurring job with dispatch and schedule another - should there be any particular benefit here?
2. On the Spritesets point
- I looked at the existing Sphere Map engine for my current project and quickly discarded it - it doesn't have nearly the level of flexibility I wanted
- So I scripted my own which is working very nicely (I can zoom in and out on the fly, move around, optimise by only drawing sprites that are on screen and handle various other things that my project wants); I'm therefore unlikely to be interested in the new map engine you're promising, at least for now.
- So why Sphere Spritesets - I want a way of having sprites that I can use easily, they need arrays of images, and directions and frames, all things that the sphere spriteset objects have
- I want to be able to load them quickly with one command rather than having a JS loop that goes through opening lots of images OR slicing up one larger image into the separate frames (I have a total of 202 images per sprite character - I split them accross two sprite files as some are a different size)
- ultimately I'm using tranformBlitMask to draw them when I need them, not any of Sphere's native sprite functions
- I don't know of a way to load an image in Sphere apart from via a spriteset or an image file (or a surface that I then slice up)
- I am using a non-sphere tool to make the spriteset graphics (it outputs a single image file with all the various frames)
- so my current process is to use the below setup code to create spriteset files (my project has a config document that stores if setup is complete or not - if not the below and a few other features are called, though for now setup only runs in 1.5 and the rest of the project only runs in miniSphere...
function make_sprite(name)
{
var input = LoadSurface("input/"+name+".png");
//make the spritesets
var output = CreateSpriteset(64, 64, 178, 21, 6);
var a_output = CreateSpriteset(192, 192, 24, 4, 6);
var t_x = 0;
var y = 0;
var x = 0;
var i = 0;
for (var y = 0; y < 21; ++y)
{
if(y < 4)
{
t_x = 7;
}
else if (y < 8)
{
t_x = 8;
}
else if (y < 12)
{
t_x = 9;
}
else if (y < 16)
{
t_x = 6;
}
else if (y < 20)
{
t_x = 13;
}
else
{
t_x = 6;
}
for(x = 0; x < t_x; ++x, ++i)
{
output.images[i]=(input.cloneSection(x*64,y*64,64,64).createImage());
output.directions[y].frames[x].index = i;
}
output.directions[y].frames.length = x;
}
for(y = 0, i = 0; y < 4; ++ y)
{
for (x = 0; x < 6; ++ x, ++ i)
{
a_output.images[i] = input.cloneSection(x*192,1344+y*192,192,192).createImage();
a_output.directions[y].frames[x].index = i;
}
}
//name the directions - based on format of sheet
output.directions[0].name = "spell_n";
output.directions[1].name = "spell_w";
output.directions[2].name = "spell_s";
output.directions[3].name = "spell_e";
output.directions[4].name = "thrust_n";
output.directions[5].name = "thrust_w";
output.directions[6].name = "thrust_s";
output.directions[7].name = "thrust_e";
output.directions[8].name = "North";
output.directions[9].name = "West";
output.directions[10].name = "South";
output.directions[11].name = "East";
output.directions[12].name = "slash_n";
output.directions[13].name = "slash_w";
output.directions[14].name = "slash_s";
output.directions[15].name = "slash_e";
output.directions[16].name = "shoot_n";
output.directions[17].name = "shoot_w";
output.directions[18].name = "shoot_s";
output.directions[19].name = "shoot_e";
output.directions[20].name = "death";
//attack animation directions
a_output.directions[0].name = "North";
a_output.directions[1].name = "West";
a_output.directions[2].name = "South";
a_output.directions[3].name = "East";
output.save(name+".rss");
a_output.save(name+"_a.rss");
}
var to_make = GetFileList("images/input");
for(var i = 0; i < to_make.length;++i)
{
if(to_make[i][0]!=".")
{
make_sprite(to_make[i].slice(0,to_make[i].length-4));
}
}