New answers tagged

1

The callback solutions via the Unity's animation system is kinda tricky and as you said expansive to maintain. I found out to discard that solution for my concerns. The global monitor solution requires a bit of effort but should give some handlable ed effective solution to the problem. But it wraps up the concept of Coroutine. A Coroutine can handle your ...


1

As you noticed, you should call requestAnimationFrame only once per frame. It means that you need to call it once upon starting your game, and then once at the end of the same function it calls. For instance: requestAnimationFrame(draw); function draw() { if (onCutScene) drawCutScene(); else if (onMainMenu) drawMainMenu(); else if (inGame) ...


0

There's no need to attacking variable. it should work. public class PlayerAttack : MonoBehaviour { private bool attacking = false; public float attackTimer = 0f; public float attackCD = .3f; public Collider2D attackTrigger; Animator anim; // Use this for initialization void Start () { anim = GetComponent<Animator> (); attackTrigger.enabled ...


0

I'm not sure if this is the answer that you are looking for as I could use some more specifics, however, the best way to actually go about animating a jump animation is to break it into 3 parts; the "Jump Start", the "Jump Loop" and the "Jump End". The Jump Start is where the character is animated jumping into the air, the loop is the movement he makes ...


0

Absolutely. The key to using the same animations on multiple characters is to ensure that all of the characters use the same skeleton. This does tend to limit you in some ways, for example your characters will all have to be the same height and proportions (i.e. same length limbs) however its quite easy to have some characters be heavier or lighter than each ...


0

I don't know LibGDX or if it has a built in animation library, but you can be certain that it does give you the ability to scale a sprite. All you have to do is use a function of the desired graph shape to pick the size you'll render the button on each frame. For example, a linear interpolation for the scaling values will produce a perfectly smooth(err, ...


0

With absolutely no disrespect intended at all- It's important to remember that with code in Stack Exchange and especially Stack Overflow and Game Development, you can't expect the community to write code for you. You must supply at least a code example and if you don't know how to code C# for Unity then there are excellent tutorials available on the internet....


-1

Look into a package like maya. It is much easier to learn how animation works that way than trying to do it programatically and looking at other people's code. On the game engine side you generally use interpolators to combine multiple animations together, but if you don't pick up the basics animation is very confusing. Even many supposed pro game ...


0

Layers are usually used for 3D animations that share common avatar and masking them. You said they are sprite animations. In case of sprite animation, ax/prop animation is done with main animation sprites or separate object animation with separate animator. If ax's animation is a sprite animation then you have to create an extra state of animation that has ...


1

Rather than loading and unloading the textures on a per-frame basis, one possibility would be to load all the frames for a certain animation at once. For example, if you're about to play the attack animation, load all the frames for the attack animation(s) into memory if they aren't already there (checking whether the animation already exists in memory would ...


0

The LibGDX Animation class is primarily a container of keyframes (Texture or TextureRegion instances) with some extra logic to pick the correct keyframe given a time and a play mode (normal, loop, ping-pong, etc...) The important part is that the timer that is used to get a keyframe is not built in to the Animation instance and so there should be a separate ...


0

if you want play once Jump animation you can use Input.GetKeyUp for falsing condition.your way isn't correct because you Check condition in Update function.In update function while condition is true do your work. using UnityEngine; using System.Collections; public class AnimationComponent : MonoBehaviour { void Start () { ...


0

at the moment the loop that run the Jump animation is infinite because if (run == true) { // this condition is always TRUE once the player press R. we can avoid it by changing that into a diffrent boolean that doesnt effect the running animation itself as I can only guess that when RUN equals TRUE the player is running so the following code should solve ...


0

Take the anim.SetInteger("stateparam", 0) from SetAnimation() method and put it in the else parts of two if statements in Update()method where you taking input.



Top 50 recent answers are included