|
Deki 0.40.1
带可视化编辑器的模块化 C++ 引擎,支持 2D 和 3D
|
本指南尚未翻译。
There are two kinds: frames that play one after another, and values that change smoothly over time.
First cut your image into frames: see Sprites. Then:
On your object, add a Sprite Component and an Animation Component, and choose the file in Animation. It plays the first animation when the game runs.
Use the names you gave them:
| Call | What it does |
|---|---|
| PlayAnimation("walk") | Plays it, and leaves it alone if it is already playing |
| PlayAnimationOnce("hit") | Plays it once, even if it loops |
| Pause(), Resume() | Freezes it on the current frame, and continues |
| Stop() | Stops and shows the first frame |
To do something when an animation that does not loop ends:
Calling PlayAnimation every frame is fine: it does not restart what is already playing.
The deki-tween package moves an object without code. Install it from the Package Manager, then add a Tween Component to the object.
| Field | What it does |
|---|---|
| Target Type | What changes: position, scale or rotation |
| End Value | Where it arrives |
| Duration | How long one pass takes, in seconds |
| Ease Type | The shape of the motion. Ease-in-out looks natural for most things |
| Loops | 0 runs once, -1 repeats forever |
| Ping Pong | Goes back again on alternate passes |