We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello is there anyway how can i make animation faster? Its the only thing thats lagging on my phone when running the project... In function i have 3 states (walk,left,right).. Every state has different image..i think thats the only thing thats lagging..thank
Answers
You can split everything which would go directly to canvas in different PGraphics objects:
https://Processing.org/reference/createGraphics_.html
Then have separate functions to process those objects running at different processes via thread():
https://Processing.org/reference/thread_.html
Just make sure to use draw() for the function image() though:
https://Processing.org/reference/image_.html
if i have 2 classes (main and player)... in both i have draw. In main im calling player.draw();.. can i use Thread for player.draw?
No! Everything related to canvas should be executed under the "Animation" Thread.
For example image(), color(), ellipse(), etc.
As I've mentioned, other things may be relegated to other threads.
For example, PGraphics and other calculus.
How can i do it? i have:
void playerAnim{ If(playerOnground){image stay} if(inAir){image in air} }
there is more function in side...