How do I set sprite animation with index rather than text

Get help using Construct 2

Post » Sun Sep 21, 2014 11:52 pm

this is a huge problem, i want to load nimation by number like i do for frames or name the frames using text or give the frames the number i want, like giving the 1st frame a number like 95 , is there any solution for this probleem

why i need it , i have some sprites each sprite have 3 animations at least each animation have only 1 frame
each time i pick a sprite i get the animation name from it. i have another button when i click i want all the sprites to change to 2nd animation for each another button to change to animation 3 it's a keybord system the sprites are keys and the buttons are making it toggle to lowercase , uppercase and special character that mans 3 layers for the keyboard. or using frames and give it text name or costum number name?

is there any solution ?
Last edited by warville on Mon Sep 22, 2014 12:01 am, edited 1 time in total.
B
12
S
6
Posts: 118
Reputation: 1,466

Post » Sun Sep 21, 2014 11:54 pm

If each sprite has 3 single frame animations, why not just use one 3-frame animation? then when you click the button, change them all to the frame you need.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Mon Sep 22, 2014 12:00 am

because then when i get the animation name it will always give me the same text because the sprite doesn't have the option to give you the animation name at an index , it's just give the current animation name.
B
12
S
6
Posts: 118
Reputation: 1,466

Post » Mon Sep 22, 2014 12:08 am

Why do you need to get the animation name? If for some reason, you really need to do it that way, you could do something like if sprite animation frame = 1, then set a variable to whatever you want it to be called. if frame is 2, then change the variable to whatever you like. etc.. then you could call on that variable to do whatever it is you're doing. (this essentially does what you were asking for originally about giving the first frame a number like 95)

But I really don't think it's necessary to do all that if I'm understanding correctly what you're doing.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Mon Sep 22, 2014 12:37 am

spacedoubt wrote:Why do you need to get the animation name? If for some reason, you really need to do it that way, you could do something like if sprite animation frame = 1, then set a variable to whatever you want it to be called. if frame is 2, then change the variable to whatever you like. etc.. then you could call on that variable to do whatever it is you're doing. (this essentially does what you were asking for originally about giving the first frame a number like 95)

But I really don't think it's necessary to do all that if I'm understanding correctly what you're doing.




unfortunatly you didn't , let me tell you why i need it you might suggest me easy solution to my problem, i hade problem with Android keyboard when it shows it scales my page down and make it very small , but i some element are important i need them to still looks big , generally i don't want the page to scaldown. i couldn't figure out how to fix that . so i decided to make my own costum keyboard , i wanted to make buttons for the keyboard but you can't text from button unless you use values don't forget each button have many layers ( i mean lower case , uppercase and special character ) so picking up a value and changing the button text each time isn't a good idea , i thought to make the buttons as sprites, and make 3 different animations for it ( lower case , apper case and special character) i used animations not frame because it have text name while frames uses numbers , so each time you touch the sprite gives you the animation name , and i will name the animations like ( char_91 ) a special text followed by the ascii code of the character shown in the animation then i will remove (char_) , why i use ascii ? because you can't name the animaton with special characters unless you name the button's animation like ("doublecotes") then make text replace and replace that part with doublecotes and that would be a pain to make a special action for each button .
B
12
S
6
Posts: 118
Reputation: 1,466

Post » Mon Sep 22, 2014 12:52 am

:? Heh. You've got me confused and overwhelmed here. I somewhat understand what you're doing here, but it seems so complicated. I'll think on it for a bit and see if anything comes to mind, but at the moment, I got nothing for ya.. Good luck!
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Mon Sep 22, 2014 1:07 am

spacedoubt wrote::? Heh. You've got me confused and overwhelmed here. I somewhat understand what you're doing here, but it seems so complicated. I'll think on it for a bit and see if anything comes to mind, but at the moment, I got nothing for ya.. Good luck!



haha thanks man, i was afraid maybe i'm just not good enought to find a solution but it seems really defficult issue :i know there is a solution but i can't do it myself because it need some Js Sdk knowledge , like wrapping the sprite plugin and make it returns the animation name at a given index.
B
12
S
6
Posts: 118
Reputation: 1,466


Return to How do I....?

Who is online

Users browsing this forum: darkrealos, plinkie, Rhindon and 20 guests