Attract-Mode Support > Scripting
shuffle module Q: regards animation
jedione:
hey guys, i have too theems that i am ready to release, but ....the shuffle module was updated
and i would like to use it... i have them working with the original shuffle.nut, but not the new one
so original sample code working....
--- Code: ---class ShufflePow extends Shuffle
{
function select(slot)
{
slot.visible = true;
}
function deselect(slot)
{
slot.visible = false;
}
}
local pow = ShufflePow(9, "artwork", "flyer");
pow.slots[0].set_pos(flx*-0.051, y, w, h);
local pic_cfg = {
when =Transition.ToNewSelection,
property = "scale",
start = 1.0,
end = size,
time = 0500,
//tween = Tween.Linear,
}
animation.add( PropertyAnimation( pow.slots[0], pic_cfg ) );
pow.slots[0].mipmap = true;
--- End code ---
each slot has a # so i can give it its own animation!
now with the new code,,,for new module
--- Code: ---## Overwrite the select function
#######################################
function select(slot) {
slot.visible = true;
slot.set_rgb (200,160,0);
}
## Overwrite the select function
#######################################
function deselect(slot) {
slot.visible = false;
}
}
## extended image list
#######################################
local pow = [];
pow.push(fe.add_image("art/icon.png", x1, fly*0.118, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.173, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.228, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.283, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.338, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.393, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.448, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.503, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.558, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.613, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.668, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.723, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.778, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.833, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.888, w1, h1));
## Create an instance of the extended class
#########################################
local list = ShuffleList(list, "text");
local pow = ShufflePow(pow, "image");
--- End code ---
their is no way to add an animation to a selected position? if that makes sence..
their all the same with just diff concordances...
help....thanks
keilmillerjr:
Your writing over the variable pow. Pow as an array and then a class. Fix that and then have your animation reference the objects stored in the array you created.
If you need further help, I can do an example later tonight when on the computer.
jedione:
yes i will need that help...and as always thank you
i know you put some good effort into making the release of this module,,and i just want to
be part of it.. to use the future code...instead of the old code. thanks bro. :D
jedione:
tell me if im wrong but wouldn't that mean,, with the old code it is already set as "objects"
because i get it to work fine...with it ?
witch would mean it is "simpler" speaking from a laymen s terms ...maybe
keilmillerjr:
Some missing information. I tried to fill in the blanks. Make notice of my comments. I also know nothing about animations, so hopefully that part works. Give it a shot, but you might have to tweak it. Going to bed. Let me know how you make out. Will check in the am.
--- Code: ---// ---------- List
class ShuffleList extends Shuffle
function select(slot) {
slot.set_rgb (200,160,0);
}
function deselect(slot) {
slot.set_rgb (200,160,0); // set to another color?
}
}
local list = []
list.push(); // add objects
local shuffleList = ShuffleList(list, "text");
// ---------- Pow
class ShufflePow extends Shuffle
function select(slot) {
slot.visible = true;
}
function deselect(slot) {
slot.visible = false;
}
}
local pow = [];
pow.push(fe.add_image("art/icon.png", x1, fly*0.118, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.173, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.228, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.283, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.338, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.393, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.448, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.503, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.558, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.613, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.668, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.723, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.778, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.833, w1, h1));
pow.push(fe.add_image("art/icon.png", x1, fly*0.888, w1, h1));
local powAnimation = {
when = Transition.ToNewSelection,
property = "scale",
start = 1.0,
end = size,
time = 0500,
}
for (local i=0; i<pow.len(); i++) {
pow[i].mipmap = true;
animation.add(PropertyAnimation(pow[i], powAnimation));
}
local shufflePow = ShufflePow(pow, "image");
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version