Scale item object

  • #20, by ke4Wednesday, 30. September 2015, 17:58 9 years ago
    Yes i like your italic little tips grin

    Just tried and it's easy to set up and works smoothly as i was imagining.
    But doesn't that means that now all the items will be constantly checking for mouse enter + i need to do it manually for every item + i can't set the pause to 999 to spare the system.
    But it's pretty cool way to manage it!

    Can i get somehow the name if the current item dynamicly inside of the animation?

    Key Killer

    810 Posts


  • #21, by afrlmeWednesday, 30. September 2015, 18:48 9 years ago
    When you apply actions to animations, they will only ever be triggered when the animation is preloaded or playing. So if the interface is hidden, the animations will not be active or if you are on a menu scene & haven't enabled the always show interface option in the properties tab for it, then the interface will be hidden automatically.

    Long story short, the speed of the loop depends on the global pause value of the animation or the unique delay you applied to the animation frame, depending on whether or not you enabled the set pause for individual frame option.

    & to answer your question: Sure you could make a more global approach to setting the frames to play between x & y, but you would still probably need to manually sort out the end frame actions. You can copy / duplicate entire action blocks, so use that to your advantage to save some time.

    Imperator

    7278 Posts

  • #22, by ke4Wednesday, 30. September 2015, 18:59 9 years ago
    Oki i think it's worth it :-)

    Key Killer

    810 Posts

  • #23, by ke4Thursday, 01. October 2015, 15:18 9 years ago
    I didn't find it in data structure, but is there a way to loop through an animation?
    Then i could do something like

    if animation.Frame == 1 then
    animation.Frame.AnimationFrameAction = action
    elseif animation.Frame == 5 then

    I can get the game items and acces all the items animations.
    I could set the same action for all animations into the first/middle/last frame.
    but then the action itself would need something like

    if game.CurrentObject:getName() == self:getName()

    Key Killer

    810 Posts

  • #24, by afrlmeThursday, 01. October 2015, 15:57 9 years ago
    Could you explain a little more clearly what you are wanting to do please?

    Imperator

    7278 Posts

  • #25, by ke4Thursday, 01. October 2015, 16:09 9 years ago
    Oh sorry, yes i want to loop through an animation - through all the animation's frames and then set an action to the frames i want. ( global action which would work for all items )

    i would check if the current frame being looped is a frame 1 and if i would set it an action


    local items = game:getLinks(VGameItems)
    local animation
    
    
    for i =1, #items do
    	animation = Objects[items[i]:getName()]:getLinks(VObjectAnimations)
    
    	for a = 1, #animation do
    		if animation[a]:getName() == items[i]:getName() then
    			--loop through animation frames
    			--if animation.Frame = 1 then animation.Frame.AnimationFrameAction = "Scenes[name].SceneActions[name]"
    			--elseif
    		end
    	end
    	
    end
    


    Key Killer

    810 Posts

  • #26, by afrlmeThursday, 01. October 2015, 16:25 9 years ago
    Hmm... Is the action unique to each scene? Also, you want to query the current characters item list as opposed to the game item list. The game item list contains all items of the game. Are you planning on doing the loop with mainLoop event or the mouseEvent?

    & er... pretend I'm stupid. Could you break what you are wanting to do down into steps with some more details please? I want to know exactly what is supposed to happen, how, why, when & what the action you want to call is for! grin

    P.S: if you include a path inside of "these" then it will no longer be a path, but will be a string instead. I also don't recommend performing for loops inside of each other, as it all gets a bit chaotic.

    Imperator

    7278 Posts

  • #27, by ke4Thursday, 01. October 2015, 16:39 9 years ago
    Oki,

    It's still the same thing, the item scaling thing. I need to export all the items as animation. 10 frames animation.
    First 5 frames is scaling up and last 5 scaling down.

    Action for the first frame of each item animation.
    setAnimFrames(name, 1,1)
    if game.CurrentObject:getName() == name then
    setAnimFrames(name, 1,5)
    end
    


    for the fifth frame
    setAnimFrames(name, 5,5)
    if game.CurrentObject:getName() ~= name then
    setAnimFrames(name, 5,10)
    end
    


    So basically what i want is do it automatically for all the items in the game as i'm too lazy do it manually for each of them ( And there will be more items in the future )
    So i know how to acces all the game items

    local items = game:getLinks(VGameItems)
    


    And all the item's animations

    for i =1, #items do
    animation = Objects[items[i]:getName()]:getLinks(VObjectAnimations)
    end
    


    But its all pointless if i can't loop through the animation itself to set (link, add) the actions to the frames ( only 3 actions for all items - first frame action, 5 frame, 10 frame )

    ..and this is exactly what is supposed to happen! grin

    Key Killer

    810 Posts

  • #28, by afrlmeThursday, 01. October 2015, 16:50 9 years ago
    Quick question: your inventory interface, is it hidden until needed? do you slide it down when needed? or is it always visible?

    Imperator

    7278 Posts

  • #29, by ke4Thursday, 01. October 2015, 16:54 9 years ago
    Its hidden then i show it and slide it down...

    ...slide it up and hide it.

    Key Killer

    810 Posts

  • #30, by afrlmeThursday, 01. October 2015, 17:12 9 years ago
    Ok dokie. You do know that you don't need to create 10 frames. You could just reverse the playback direction of an active animation?

    What you are wanting to do, could be classed as a little overkill > running a loop, to run a loop, to run another loop. Like a bloody tongue twister.

    If you do want to go down the loop method then I recommend only creating the loop event when you show the interface & quiting it when you hide the interface. The animations will reset themselves automatically when the interface is next shown anyway.

    I don't think you really need the multiple for loops either. One should probably be enough. get it to loop through the character items & check if any of the items are the current object & if so check if the current frame is less than 5 and if not set frames 1 to 5 else check is 5 then set frames to 5, 5. Next the else part for not current object you check if animation frame > 1 & if it is then you set animation direction to backwards & frames 1, 5. then same as before you also run a query to check if frame is 1 then set frames to 1, 1. Ah you would also want to set playback direction to forward for when scaling animations up.

    Sounds a little complicated in text, but I think it should work ok - providing the system loop catches the animations while they are on specific frames each time.

    Imperator

    7278 Posts