Replies: 2 comments 2 replies
-
Hi, you check the syntax in this sample See if it works for you and let me know if it doesn't. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I have managed to capture the 4 positions Up-Down-Right-Left from the same template. But I had to perform the construction of the Player every time the corresponding action is executed. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question: AnimationChannel does not work with AnimatedTexture.
I have an image with 4 rows (left,right,up,down), in each row there are 3 frames.
I can extract a part of the image and save it with subTexture():
AnimatedTexture animTexture = texture("imageSprite.png").subTexture(new Rectangle2D(0, imagePlayerY, imagePlayer.getWidth(), 30)).toAnimatedTexture(3, Duration.seconds(0.6)).loop();
I thus obtain an AnimationTexture with the image cropped.
The problem is that AnimationChannel does not work with AnimatedTexture.
I have not been able to update the animatedTexture in playerComonent.
So what I've done is edit the sprite.png and have 4 separate images.
But the question is: how can I update animatedTexture using subTexture every time the movement is made (onKey(KeyCode.A, “left”, etc.). Since this way we would only be using a png resource to all movements.
Beta Was this translation helpful? Give feedback.
All reactions