Comments (10)
Hello, your updateAnimation function is called by the update & attack method. It's probably not what you want... ?
from citrus-engine.
Actually, to call or not call the updateAnimation() inside attack() has no importance, I pulled out the call and the effect remains the same.
The fact is that when I call this line:
(view the AnimationSequence). onAnimationComplete.addOnce (attackFinishedAnim);
AttackFinishedAnim function is performed once or twice and then no longer runs.
She should infinite loop every time the animation ends, and it does not.
from citrus-engine.
(view the AnimationSequence). onAnimationComplete.addOnce (attackFinishedAnim);
You've used addOnce, so attackFinishedAnim function will perform only one time!
from citrus-engine.
The function attack () is executed when "_isAttacking = false" as shown inside updade ().
So when I run onAnimationComplete.addOnce, I am referring only 1 attack, when I restart the process, the hero will run the second attack, the function is called again, then run again another onAnimationComplete.addOnce
But anyway, I changed the line to
(view the AnimationSequence). onAnimationComplete.add (attackFinishedAnim);
And got the same result.
The result is different in your test?
from citrus-engine.
I don't have material to test.
Could you show us the updateAnimation function?
Also I've heard that it may have a bug in Starling 1.3 concerning animation complete: http://forum.starling-framework.org/topic/animation-eventcomplete-fires-early not sure if it was baked into Starling 1.3
Also it seems more related to Starling itself than Citrus Engine. Could you try a simple test running only on Starling and then on the Citrus Engine ? (You may want to duplicate the AnimationSequence class). Thanks!
from citrus-engine.
Do you still have the issue?
from citrus-engine.
I no longer have the problem. Decided to go for another logic.
from citrus-engine.
Ok, I hope everything is going well.
from citrus-engine.
Hey, I think what you're looking for is the StarlingArt.setLoopAnimations(tabAnimations) function ;)
Le 14 mars 2013 à 19:34, dkfast [email protected] a écrit :
Hey Aymeric, I know this post is closed, and i apologize for posting back on it, but i didn't know of another way to contact you. I seem to have a similar issue as to the original poster here. I am using a sprite sheet for all my animations for my hero. I have also been loosely following the "Braid" example to help with my custom hero animation frames. I have run into this issue and i just cannot seem to figure out no matter how many examples and posts i read. All my animations are now playing, however they all stop on the final frame and just stay there. for example if i hold down the "left" arrow my character runs left correctly, but when his animation frames end the character continues to move left, but he looks like he is frozen. I'm fairly new to Citrus and so far i love it, i just cant seem to figure out what im doing wrong on this. Thank you in advance for any help you may have.
below is the main part of my custom hero class, if you need to see more please let me know. I'm sure this isnt the best way to do things but again im kind of learning as i go along, reading through all the docs trying to figure it out.
public var canUseSword:Boolean = true;
public var isAttacking:Boolean = false;
public var swordExists:Boolean = false;
protected var _sword:Sword;
protected var _swordJointDef:b2WeldJointDef;
protected var _swordJoint:b2WeldJoint;public function HeroClass(name:String, params:Object = null)
{
super(name, params);
}override public function update(timeDelta:Number):void
{var velocityX:Number = velocity[0];
var velocityY:Number = velocity[1];if (_onGround && !isAttacking)
{
this.animation = "MainNeutral";
}if (_ce.input.isDoing("right", inputChannel))
{
if (!isAttacking)
{
if (_onGround)
{
this.animation = "MainRunCycle";
this.velocity = [7,velocityY];
}
if (!_onGround) this.velocity = [5,velocityY];
_inverted = false;
}
}if (_ce.input.isDoing("left", inputChannel))
{
if (!isAttacking)
{
if (_onGround)
{
this.animation = "MainRunCycle";
this.velocity = [-7,velocityY];
}
if (!_onGround) this.velocity = [-5,velocityY];
_inverted = true;
}
}if (_ce.input.isDoing("jump", inputChannel) && _onGround)
{
if (!isAttacking)
{
this.animation = "MainJump";
this.velocity = [velocityX,-12];
onJump.dispatch();
}
}if (canUseSword && _ce.input.isDoing("attack", inputChannel))
{
isAttacking = true;
swordExists = true;
if (_onGround) _animation = "MainBasicAttack";
if (_inverted) {
_sword = new Sword("Sword", {x:x - width, y:y, width:30, height:10});
} else {
_sword = new Sword("Sword", {x:x + width, y:y, width:30, height:10});
}
CitrusEngine.getInstance().state.add(_sword);_swordJointDef = new b2WeldJointDef(); _swordJointDef.Initialize(_body, _sword.body, _body.GetWorldCenter()); _swordJoint = b2WeldJoint(_box2D.world.CreateJoint(_swordJointDef)); _box2D.world.DestroyJoint(_swordJoint); CitrusEngine.getInstance().state.remove(_sword);
}
if (swordExists && _ce.input.getActionValue("attack") != 1)
{
isAttacking = false;
swordExists = false;
}
}—
Reply to this email directly or view it on GitHub.
from citrus-engine.
Yes! that was it, thank you very much Aymeric. I actually figured that out soon after i messaged you, i tried removing my original post as to not bother you with it. But again, thank you for your time, i very much appreciate it!
from citrus-engine.
Related Issues (20)
- MediatorScene._poolObjects after scene cycle, has null. HOT 2
- Implement a 'remove()' method to PhysicsCollisionCategories.as HOT 1
- ObjectMakerStarling is using old QuadBatch HOT 4
- Feathers swc version problem
- rename _realState to _realScene in display list Scene
- Jump bug CE 3.1.12 + Nape HOT 2
- MathUtils
- ViewportMode.FULLSCREEN -> ViewportMode.SHOW_ALL
- GameInput : update CE's input package
- easy way to activate/deactivate objects
- Accessing undefined properties starling.contentScaleFactor HOT 7
- CitrusSoundGroup could be created like any other CE object, not only creating a custom class HOT 3
- FluidBox.as needs to be removed HOT 1
- SpriteArt/StarlingArt dragonBones code HOT 2
- CitrusStarlingJuggler (pausable juggler) per StarlingScene
- Get rid of linked list in the pooling system
- The classes should implement the functions of interface 'ISpriteView' HOT 1
- Camera onPostUpdate / enabled
- Create NapePhysicsCompound/Box2DPhysicsCompound
- Yay
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 citrus-engine.