≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
How to know if playing of an animation has ended?
Posted by:
(you are not logged in)
Enter the missing letter in: "I?ternational"
(you are not logged in)
Text:
[quote][b]DeltaXGames[/b] wrote: It's not possible to read it (or so I believe), I've tried! The only way I know to do this is with a (simple) hack. If you know how long the animation lasts (you can easily read this in the animation editor), you could start a timer at the start of the animation and then execute your action at the end of the animation . Here's some example code, here I force the player to wait till the reload animation has played before he can fire his weapon, may not be exactly what you are looking for but I hope it helps you. var __deltaTime=0; var __lastTime=0; var isFirstCount=true; function getDeltaTime() { var now=(new Date()).getTime(); if (isFirstCount) { __deltaTime=0; isFirstCount=false; } else { __deltaTime=now-__lastTime; } __lastTime=now; } ccbRegisterOnFrameEvent(getDeltaTime); //End of Delta Time Code var animationEnd=1000;//the length oth the animation in milliseconds. You might need to reset this every time the animation starts. function gameLoop() { //put your game code here if (animationEnd<=0) { //The animation has ended; } else { animationEnd-=__deltaTime; //animationEnd=1000; //If the animation is looping then you might need to uncomment this. } } } ccbRegisterOnFrameEvent(gameLoop);[/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact