Tag Info

6

Well tweening in the general case is just parametric movement (specifically, defining a function f(x) where x can be 0..1 for position/rotation/scale/whatever) with a modifier on the parametric value you pass in. The modifier also has the range 0..1. If you plot the algorithm on a graph you'll get something that starts at 0, ends at 1, and the slope of the ...

6

After playing with this function more. I realise that the bezier control points are acting similar to magnets. If I spread the control points so that they are positioned along a straight line with equal distance between, then the animation works as expected { p0: new Vector(0,0), //Start point p1: new Vector(.333,.333), //Control point 1 p2: ...

5

I usually solve this using Catmull-Rom splines. Instead of using control points, you simply specify the two points between which you'd like to interpolate, as well as a "previous" point and a "next" point. If the 4 points all lie on the same line and are evenly spaced, the interpolation will be linear. In the image above, there are four points p0, p1, p2 ...

5

It is called a barycentre. Here your point is: P = (A * A_ratio + B * B_ratio + C * C_ratio) / (A_ratio + B_ratio + C_ratio) Badly, Wikipedia have no dedicaced page for this, so you'll have to understand the explanation of center of mass, which is just a generalization of barycentres applied to physics. EDIT: your second method is equal to: P - default ...

4

I've written a primer on interpolation, which may be of some use - http://iki.fi/sol/interpolation/ Another great resource is this interactive tool: http://www.gizma.com/easing/

4

I have got it working now! I just missed one vector difference and one multiplication. here is the code: function moveFocused( center, bbox ){ var moveData; if( ! this._animationData.hasOwnProperty( 'moveFocus' ) ){ this._body.SetLinearVelocity( new b2Vec2() ); setBodyType.call( this, b2Body.b2_kinematicBody ); var m = this....

3

Go to the DOTween documentation Scroll down to the Move section. Click on DOJump to expand that explanation. Is that what you're looking for?

3

The problem seems to be that if i create a list of Tweens, then call update, it uses Tweens implementation of Tween.update() and not it's inherited children, I don't know how/if it's possible to allow this... Of course it's possible, that's the whole idea of polymorphism. You just need to ensure two things: 1) Mark the Update method as virtual in your ...

3

I fail to see what's the problem you're having. Update the time of day and tween the colors in the Update method (assuming it has access to the dt) and leave the Draw method only for rendering. I think that's the more logical solution. Also, encapsulate this in some sort of Sky class if you haven't done so already. So I'd definetly stick to the 2nd option. ...

3

That type of control scheme is totally useless as you will overload the players with information and at least the reaction time will suffer considerably,that is why mouse is preferable since a lot of variation can be made If you want variety in animation you don't need convoluted controls schemes, you can use either procedural animations and/or blend ...

2

Take a look at the Grapefrukt Exporter library.

2

From what you describe, your problem is probably relative to the movie-clip you are targeting to test collisions with. To be more precise, I think you are testing your collisions against the movie-clip containing the enemy animation and the enemy graphics. But indeed this movie-clip doesn't move at all... it's fixed and only its content is moving (well at ...

2

I solved it! I forgot to add this code at the render() method: Tween_Manager.update(delta); // --> Set update to enable animation changes.

2

I went ahead and made it since I think it could be useful for me in the future. This implementation uses ellipses to determine the object location. All you have to provide is the speed, height of the ellipse, and start and end locations. Edit: I modified it to support slowing down near the end. It uses new decayStart and decayAmount variables. Both of these ...

2

For some reason the tween library requires you to update the tween inside your onComplete function, and calculate the time using something like the following: .onComplete(function () { tweenStart.x = pos[i][0]; tweenStart.y = pos[i][1]; i += 1; if (i >= pos.length) i = 0; tweenEnd.x = pos[i][0]; tweenEnd.y ...

2

I would recommend representing the position of the animated sprite as a Vector2, then to use the universal tween engine you would first have to implement a TweenAccessor for that type; public class Vector2Accessor implements TweenAccessor<Vector2> { public static final int TYPE_XY = 1; @Override public int getValues(Vector2 target, int ...

2

Bezier curves are inherently for making smooth curves. Linear interpolation is simpler. To linearly interpolate two points, you can simply apply the following formula for time t in [0,1]: interpolatedPoint = startPoint * (1 - t) + endPoint * t When t=0, the interpolatedPoint is exactly equal to the startPoint. Similarly, when t=1, the interpolatedPoint is ...

2

This is simply a combination of a few simple steps. First, get the mouse position, Gdx.input.getX() will give you the mouse X position. You'll want to get that position at the time the mouse button was pressed. Now, that you have a target, move your hero towards it. You can do that with something like: float deltaV = deltaTime * speed; if (Math.abs(...

2

This is just speculation: Maybe you forgot to call act() on your Stage that has all the Actors. Actions are updated per frame through the act() method on each Actor which is called by Stage's act(). public void render () { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); } From https://code....

2

Why are you using bezier curves to do a linear interpolation? You could just use a linear interpolation to do linear interpolation and not use curves at all. If the reason is that you want to have a more general purpose curve based interpolation system and you are trying to get it to do a linear interpolation for a specific usage case, there is a way. ...

1

How about changing your approach to the simpler solution? You could just manually rotate the sprite in your update-method with something like the following: sprite.setRotation((sprite.getRotation() + rotationSpeed) % 360);. That way the sprite will smoothly spin around forever, and your code stays clean and straight-forward.

1

Calculate the relative offset from Default to each point and add them on top of Default with the given weights. This means that you can't divide by the sum of the weights unlike in the previous answer you got. deltaA = A - Default; deltaB = B - Default; deltaC = C - Default; point = Default + deltaA * weightA + deltaB * weightB + deltaC * weightC;

1

In the /libs folder, right click the two tween-engine.jar files, Build Path > Add to Build Path

1

You don't. That defeats the purpose of a tween. A tween is supposed to control the speed itself using an easing function and giving it a total time. If you want to control the speed of an object, you'll have to give it a velocity yourself and update it through your normal game loop.

1

You haven't shown any code, so I don't know for sure but I think your sprites have an origin that lies in the middle of it. Here is how the actual sprite is created in model space: As you can see we have 4 vertices at each corner. This makes our quad and we texture map it with the sprite we want. The important thing to note here is that the origin is in ...

1

When dealing with splines, how your interpolation works at a point is determined by the continuity of the spline at that location. This will vary depending on the type of spline you are using but at the very least you want your incoming and outgoing tangents to have the same direction at point A. If you make sure the tangents are also the same length at ...

1

A standard "tween" algorithm usually works by simplifying a more general hermite spline function, to eliminate the necessity of manually providing initial and terminating velocity values. But if you wish to be able to switch from one tween to another, you can no longer do that, and you'll need to use a full, non-simplified spline calculation. Here's some ...

1

Your problem is that you are using t and moving the time forward, in a parametric equation t represents any varying quantity and that doesn't strictly mean you should move the time forward. This can be simply achieved by writing an interpolation in a loop and increment t just at initialization time. // call this at initialization time int stepsCount = 10; //...

1

I've had issues with the Tween library and I usually find I have to eliminate variables and until it works and then add them back in. Some things to try: Did the animation work before you added repeatYoyo? Did you mean to set the Alpha to 3? Usually this ranges from 0 to 1. Did you try it without any easing? Good Luck!

1

I'm under the impression AS3 is a retained-mode API. You create a collection of objects - it draws and manages them for you. XNA, on the other hand, is an immediate-mode API. You are responsible for drawing things each frame, reading inputs each frame, keeping track of time, and so on. Here is a complete game class to demonstrate what you want. Just paste ...

Only top voted, non community-wiki answers of a minimum length are eligible