Comments (11)
That's a nice addition. Any reason to avoid an update()
method, @IQAndreas ?
from flixel.
FlxTween? Does flixel-community have tweening?
from flixel.
Yeah, a very simple class was added to handle some dirty work.
from flixel.
To have it work natively with flixel's update loop it might be better to have it extend FlxBasic (just another thought).
from flixel.
FlxTween? Does flixel-community have tweening?
Any reason to avoid an
update()
method, @IQAndreas ?
I thought I had a good reason for it. The only thing I remember thinking was that for performance (and synchronization) reasons it may be a bad idea for each instance to have its own "ticker", but we should instead use the "global Flixel time" in some way. If we add it to the list of items that Flixel updates each frame, it would be perfect.
Looking at the way the FlxTween
class is currently being used in FlxSound
, the progress is updated each frame anyway.
Keep in mind though, you cannot increment with ++
with each call to update, you need (provided it updates each "Flixel Frame"):
public function update():void
{
this.progress += FlxG.elapsed;
}
I would also recommend adding an autoUpdate
flag to the constructor in case users want to manually control the progress based on something other than time. As an example, I considered using FlxTween
to control sound panning based on an object's location between the left and right side of the screen.
from flixel.
To have it work natively with flixels update loop it might be better to have it extend FlxBasic.
Although, FlxBasic
contains many extra properties and values that are unnecessary for just a simple Tween instance.
Also, I would like Tweens to be updated before any classes that use the tween values get their update()
method called (perhaps at or before the preUpdate()
stage would be best). That way, all places that use the tween get the exact same value
each frame.
I don't see a problem in just adding a separate loop in FlxGame
that updates all tweens before updating all FlxBasic
instances.
from flixel.
In HaxeFlixel, we have a TweenManager
plugin that updates all the tweens each frame. I think that's a solid approach, also makes it consistent with the TimerManager
.
Tweens themselves are created via static methods like FlxTween.tween()
and automatically added to the manager, making them very convenient to use.
from flixel.
In HaxeFlixel, we have a
TweenManager
plugin that updates all the tweens each frame. I think that's a solid approach, also makes it consistent with theTimerManager
.
That would work! :) And that way only one item has the overhead of extending FlxBasic
, and ticking every frame.
from flixel.
Then we would need a function to add FlxTweens to the manager though.
from flixel.
I think update()
and progress
can live together. It's up to the developer to decide what to do. E.g. if I just want to "step" the tween and I don't care how it will be done, a call to update()
will do the trick. If I want a fine control over the increment, I can manipulate progress
directly.
I like the idea of a TweenManager as @Gama11 suggested, but I don't like the idea of tweens being automatically added. IMHO the less automatic things we have, the easier to understand what is going on.
My idea:
// I want total control
var t :FlxTween = new FlxTween();
while(myStuff()) {
t.update();
}
// or I want Flixel to take care of it for me
FlxG.tweens.add(t);
// later...
FlxG.tweens.remove(t);
from flixel.
While I agree on tweens not being added automatically to the manager I believe they should be removed by the manager automatically once they are finished as it would be redundant to increment the progress over 100% when it will be set back inside the tween to 100% automatically.
from flixel.
Related Issues (20)
- Use bitwise operators for faster Math functions HOT 6
- Add FlxRandom seeded random generator HOT 13
- Add ray casting with soft shadows HOT 6
- Centralize all input handling in FlxG.input HOT 2
- Achievements in Flixel HOT 3
- Overhaul the built-in debugger HOT 7
- Instantiable FlxColors HOT 6
- Community Notice Board HOT 3
- FlxTilemap() can't draw one-column tilemap - BitmaData exception HOT 4
- Create flixel-demos repository
- Bump version 2.58 to 3.0 HOT 2
- Add property "position" to FlxSprite HOT 4
- Implement FlxG.assets
- Dev branch lacks clear notice of Genome2d Dependency HOT 1
- Cannot get to compile against Genome2d SWC HOT 11
- FlxRandom has ASDoc validation errors HOT 3
- Context3D "Texture too big" error HOT 7
- [GPU build] calcFrame() wrong order HOT 2
- Current state of Flixel on GPU? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flixel.