Android LIBGDX Game Engine Development Tutorial (ix) The use of animation classes

Source: Internet
Author: User
Tags time interval libgdx

For a successful game, animation effect is one of the indispensable elements of the game, then we will explain the use of animation classes.

First, Animation class

1, Animation introduction

The class is stored under the Com.badlogic.gdx.graphics.g2d package, which inherits from object.

2, animation definition

This is the official API definition, presumably means: an animation is stored in a list of pictures to show the sequence of time interval set. For example, a person who is running or is beating.

3, animation use

Manage animations and set the playback mode and playback order.

4. Animation usage

This is the constructor of the animation, and we'll explain the parameters in one at a while:

<1> float frameduration: The time interval to play each frame;

<2> array<? Extends textureregion> keyframes: Storing an array of animated pictures;

<3> int Playtype: Mode of playing animation, it provides 6 kinds of modes: NORMAL, reversed, LOOP, loop_reversed, Loop_pingpong, Loop_random:

①normal: normal playback mode;

②reversed: The direction play, from the back to play, this is like a character backwards running;

③loop: Continuous playback, this is more commonly used;

④loop_reversed: continuous backward playback;

⑤loop_pingpong: Play a few pictures forward, and then play a few frames back picture;

⑥loop_random: Continue to play immediately.

<4> textureregion ... keyframes: An array of images to store textureregion.

5, sample diagram

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.