forum

Creating/naming hundreds of images in SGL/SGF

posted
Total Posts
2
Topic Starter
ziin
I'm trying to recreate the a background using 240 horizontal lines so I can smoothly flip the image line by line (or column by column).

Other similar things would be breaking up an image into ~100 smaller images and reassembling them or "destroying" the image.

Damnae helped me out tons with getting things started but I'm still lost, so I'd like to start the discussion here rather than hidden in some other thread.

So, I feel like I need an array of sorts:

var spritename  = "";
var myArray = ["1.png","2.png","3.png"];

for (i=0,i<240,i++) {
spritename = i + ".png";
myArray[i] = new Sprite(spritename);
myArray[i].scale(0,0,9999,0.625,0.625);
return myArray[i];
}
function moveBG(spritename) {
for (i=0,i<240,i++) {
spritename[i].move(0,0,9999,0,0,640,0);
}
}
moveBG(myArray);

I can provide working script a little later, I just have to create each image in the loop and do absolutely everything in that single loop since I can't reference an of the images later.
-[Cow]-
Sorry if I bumped...

Try this. Modify if needed. Drunk Osugye coded this.

function splittedBG(P,X,B) {
var split = new Sprite("SB/"+(P)); // Change the directory to the picture's directory.
// Now add the random stuffs here.
split.moveX(0,9999,0,640); // Added this for an example(?)
}

function splitBGgenerator(amount,Xpos,Beat) {
for (var i = 1;i<amount;i++) {
Beat = Beat + Beat; // Remove Beat if you want, :/
Xpos = Xpos + (Xpos / 2); // Actually, add how wide the pictures are here.
splittedBG(i,Xpos,Beat);
}
}

splitBGgenerator(4,55,310);
// First line = If there are 3 sprites, do 4, and if there are 9, do 10.
// Second = X position of the first picture, to be followed by the others
// Third = Remove if you want :/... Use if you want something to be followed.

// IM AN IDIOT, CHANGE IF NEEDED.
Please sign in to reply.

New reply