bruserker Posted February 28, 2016 Share Posted February 28, 2016 Some days ago I've started developing an animated odometer written in HTML and javascript, which I intend to use on a rpg game that I am developing. Right now, I am facing a problem regarding the animation. The description of the problem as well as the source code can be found here: http://stackoverflow.com/questions/35615811/odometer-animation-using-pixi-js Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 28, 2016 Share Posted February 28, 2016 var actualHP = document.getElementById('actualhp').value; var newHP = document.getElementById('newhp').value; actualPP = document.getElementById('actualpp').value; newPP = document.getElementById('newpp').value; var difHP = newHP - actualHP; var difPP = newPP - actualPP; var difHPPixel = difHP * 48; var difPPPixel = difPP * 48; These values are the same every update. I dont understand what do you want to do with that, your problem is not connected to PIXI or animation, its pure algorithmic problem. josescxavier 1 Quote Link to comment Share on other sites More sharing options...
bruserker Posted February 29, 2016 Author Share Posted February 29, 2016 Sorry for the mistake, I am not that used to scripting languages. Since you've managed to analyze the code and point out the problem, would you have a better idea for solving this issue? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 29, 2016 Share Posted February 29, 2016 I dont know, you just have to understand how to write a game loop , I studied it looong time ago in Turbo Pascal 5.0 1) You have to mark which variables are actually current state of your counter. 2) Write a code that will update it based on DELTA TIME between current frame and previous. Use "Date.now()" to know about milliseconds. 3) Write a code that translates your state into PIXI components. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.