layout animations correctly

55 views
Skip to first unread message

Caiota

unread,
Aug 7, 2019, 8:24:33 PM8/7/19
to DroidScript

hearthstone-attack-animation-opt.gif

how to make layouts animation in droidscript look like this gif? the bottom card going to "attack" the top card and then back to the original position. I'm producing a game like this :)

Screenshot_20190807-212318.png

For now in the second image, they are still, I tried a few things but it's not as I need it to be, or the image goes to the top of the screen and that's not what I'm looking for.

Symbroson

unread,
Aug 7, 2019, 9:39:02 PM8/7/19
to DroidScript
Try if the 'obj.Tween' method offers what you want. Should be documented in the docs, ie CreateImage/Tween

Caiota

unread,
Aug 8, 2019, 1:45:48 AM8/8/19
to DroidScript
it was great, but you know why it is 'locking' the image like this? look at the moving image, it gets all locked: Animation Vídeo

Symbroson

unread,
Aug 8, 2019, 4:34:35 AM8/8/19
to DroidScript
I guess you mean it is jumping around?
What animation type are you using?
Try if other types are working better

Caiota

unread,
Aug 8, 2019, 5:10:08 AM8/8/19
to DroidScript
 target = { x: 0.6, y:0.5}; 
ataque.Tween( target, 400,"Exponential.Out", 0, false,teste3 );

but i test only  ataque.Tween( target, 400); and have same result

Caiota

unread,
Aug 8, 2019, 5:12:13 AM8/8/19
to DroidScript
yes I want to make the bottom image attack the top image with a nice effect, but it gets tremulous kkkk

Symbroson

unread,
Aug 8, 2019, 5:25:47 AM8/8/19
to DroidScript
try the Bounce animation

Caiota

unread,
Aug 9, 2019, 3:21:01 AM8/9/19
to DroidScript
same "laggy effect"

 target = { x: 0.5, y:0.15};
    ataque.Tween( target, 400,"Elastic.Out", 0, false,teste3 );


function teste3(a){
  
    target = { x: 0.6, y:0.5};
    ataque.Tween( target, 400,"Elastic.Out", 0, false,teste4 );
}
function teste4(){
    target = { x: 0.6, y:0.5};
    ataque.Tween( target, 400,"Elastic.Out", 0, false,teste5 );
 
}
function teste5(){
    target = { x: 0.4, y:0.75};
    ataque.Tween( target, 900,"Elastic.Out", 0, false,teste5 );
 
}

Symbroson

unread,
Aug 9, 2019, 5:34:38 AM8/9/19
to DroidScript
The reason for that is that you've set teste5 as callback for the teste5 animation. so when your animation is done teste5 will be called infintely which will cause your second animation to be laggy.

I've fiddled around with the animations a bit and this seems quite fair to me:
Adjust it for your needs as you like

function teste2() {

    target
= { x: 0.6, y: 0.5 };

    ataque
.Tween( target, 600, "Circular.InOut", 0, false, teste3 );
}
function teste3(){

    target
= { x: 0.5, y: 0.15 };

    ataque
.Tween( target, 600, "Elastic.Out", 0, false, teste4 );

}
function teste4(){
    target
= { x: 0.6, y: 0.5 };

    ataque
.Tween( target, 500, "Circular.InOut", 0, false, teste5 );

}
function teste5(){
    target
= { x: 0.4, y: 0.75 };

    ataque
.Tween( target, 500, "Circular.InOut", 0, false );
}


Caiota

unread,
Aug 9, 2019, 1:13:06 PM8/9/19
to DroidScript
alright i will try here thank you so much for the help again <3

Caiota

unread,
Aug 9, 2019, 1:24:42 PM8/9/19
to DroidScript
I discovered the mistake that made this happen
The function that calls the first animation was executed 2 times and not only once and thus it triggered the others also in the same image, generating this error.

now it's good and I can model it as I please. thank you very much for all the help
Reply all
Reply to author
Forward
0 new messages