Libgdx animation , animates only on Animation.LOOP_RANDOM mode - android

I am creating an android game in libgdx engine.My Animation object and rendering code is as
rightAnim=new Animation(0.02f, rightRegions);
rightAnim.setPlayMode(Animation.LOOP_RANDOM);
//Rendering
batcher.draw(rightAnim.getKeyFrame(runTime,true),hero.getX(),hero.getY(),hero.getWidth(),hero.getHeight());
I can see this animation running only on "LOOP_RANDOM" mode, but I want it to play normal loop.In other loop only 1st frame is drawn for eg. in "LOOP_REVERSED" mode only last frame is drawn.I googled 2 days but couldn't find solution.Please help me out and sorry for my bad English .

This:
rightAnim.setPlayMode(Animation.LOOP)
is the correct play mode for a standard animatin loop, and should give you the behavior you want. If that is not working, something is probably wrong with the time ranges you are using.
Try increasing the frameDuration argument from 0.02 to 0.20 and see if you can at least see your animation play through correctly (if slowly).
Also, make sure your rightRegions list is correct.
Finally, what is your code for updating runTime? Make sure that is changing correctly.

Related

unity Bézier Path creator android moving problem is start laggy when scene changed

Im using bêziers path not vertex one. And in editor(windows) there is
no problem with it. im building for android and trying to play with
galaxy m21. first scene is completely normal. but when it comes for
other scenes it start moving laggy (because of path follower i think).
(im not talking about side walks just movement to forward along the
path)
there is 4 scene and this is looping when click next level in the end.
if we return to first scene that one starts to laggy movement.
game is a little city we move in streets so i was thinking maybe
render based problem so i delete every gameobject about city it became
almost some kind of empty space and tried, same problem.
also i was using different gameobject to follow pathfollower so i
remove that and put my player directly inside pathfollower but it
remains same. when i go next level it starts moving laggy not smooth.
(i understand it because there is trail and shaking time to time)
finaly i add game manager's awake() System.GC.Collect();
Resources.UnloadUnusedAssets(); maybe it helps when nextlevel loaded.
but still it is laggy forward movement.
any idea what is going on? i can take any suggestion thanks for help.
i just find it i was using Dotween for side movement but it was using x,y and z That was my problem.
I dont know how it works when its first loaded. I mean if i load the game and play it works first level but other levels starting >
-sorry i dont know exactly word but its lagging/freezing in the movement.-
But if i close app and start again, that same level works just fine.
Anyway i just tried to disable that script at tried and i see no shaking/freezing in the trail so, i think that was the problem, thats my fault i think like i said, i'm new :)
now i try use tween except the z or try completely diffrent thing.

Unity 4.5 : make character start an animation triggered by touch

1-I am making a small app in 3d mode for android using blender and unity.
2- I made rigged character with an iddle animation and a happy animation in blender.
3 -I imported it correctly into unity. i put the bool parameters in the unity animator and all works fine, even tested on the phone.
Problem:
I cant find a good tutorial to create the interaction(code) between the animations and the touch screen event.
hope you can understand me. Thanks in advance!
If I understand correctly you want to transition from Idle to Happy Animation on the touch of a button and you said the animation is not a problem.
Since you have not provided any code I can tell you the algorithm.
In update check whether someone is touching the screen.
Then check if the phase of the touch is "began".
If someone is touching the screen, use the Animator.SetBool() function to set the boolean for the animator to true.
Setting it to true will transition it you have set the transition condition to the above mentioned boolean.
Use the Unity Scripting Reference to understand the touch functions better.
Unity Touch Scripting Reference
And I would recommend watching this Animator Controller Tutorial to learn about it.

Animation Issue on Unity 3D

I made an 2D animation on Photoshop and I'm building 2D interactive novel for Android. I added 16 images to my scene and named it Myanimation. I need to play this animation after 10 secs from beginning. So I need to set Legacy on from Myanimation's debug menu. But when I click Legacy's box Myanimation's size in "Pptr Curve Mapping" changing to 0. And my animation doesn't play. (I think the problem is this. Coz If I try working with only 1 image and build moving animation it works.)
Anyway I am adding Animation (Add component-> Miscalleneous -> Animation) and adding Myanimation in it. And build a script like that
function Start() {
Invoke("Ersakonus", 1);
}
function Ersakonus() {
animation.Play("Myanimation");
}
But when I play the game (Novel) it doesn't work. I need this coz I need to let other character's animations one by one while they are talking with Invoke.
Can you plase tell me how can I fix this issue?
Let try Animation.CrossFade
https://docs.unity3d.com/ScriptReference/Animation.CrossFade.html
And then check your animation component have animation named or something but If u want Novel unity game take a look.
https://www.assetstore.unity3d.com/en/#!/content/9416

Android video-like animation, how to create?

In this mock up, see the screen where it said "Decrease Traffic", the traffic light pops up from below.
https://dribbble.com/shots/2106573-Intro-App-Interaction
I'm wondering how to create that effect on Android, if possible, any library to do that. Thanks
you can achieve this with Android Property Animations
in your example it seems to be a scale animation from 0 to 1 in x and y direction.
you can also combine different animations to get such or other effects.
My guess is that these kind of animation are to develop with a 3rd party program, and are not done by Android itself.
This way you have a ready-to-instantiate file (.gif maybe?) that you just call when the view pager is switched.
Looking also to the other animations in the example (look # "Meet New Friends", how every circle pops by himself) I think this was the used approach in your example-link.
If you are anyway looking for something that would look like what is done there, I'd suggest you start playing around Animator objects (and its subclasses like Value/ObjectAnimator) to animate the view you want.
This can be done also via XML files, describing the animation you need.
An important role in this do-it-yourself animation is played by Interpolators , who give you the chance to further customize the animation in an easier way (take a look at OvershootInterpolator, which lets your animation go a bit after the destination value you set, just to turn back later, giving you a "blob" effect. This might give a better idea what I'm meaning)

lbgdx - Particle Effect is not rendering

I have a problem attaching a Particle Effect, made by the particle editor, in my android code. It is just not rendered in runtime, even if the duration of the effect should be around 3 sec and it is positioned on the center of the screen.
As I can see some few other users faced with this kind of problem before but every answer they got didn't help me.
Here is my code:
// in creating
effect = new ParticleEffect();
effect.load(Gdx.files.internal("effects/prova2.p"), Gdx.files.internal("effects"));
effect.setPosition(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
effect.start();
//in rendering
effect.draw(game.batch, delta);
Also I tried to change "delta" with my world step value (1/40f) or calling Gdx.graphics.getDelta() but that doesn't seem to be the problem.
It seems like you're not updating the particle effect.
Try including:
effect.update(delta);
effect.draw(game.batch);

Categories

Resources