官术网_书友最值得收藏!

Sprite animation

With Area2D, you can detect when other objects overlap or run into the player, but Area2D doesn't have an appearance on its own, so click on the Player node and add an AnimatedSprite node as a child. The AnimatedSprite will handle the appearance and animations for your player. Note that there is a warning symbol next to the node. An AnimatedSprite requires a SpriteFrames resource, which contains the animation(s) it can display. To create one, find the Frames property in the Inspector and click <null> | New SpriteFrames:

Next, in the same location, click <SpriteFrames> to open the SpriteFrames panel:

On the left is a list of animations. Click the default one and rename it to run. Then, click the Add button and create a second animation named idle and a third named hurt.

In the FileSystem dock on the left, find the run, idle, and hurt player images and drag them into the corresponding animations:

Each animation has a default speed setting of 5 frames per second. This is a little too slow, so click on each of the animations and set the Speed (FPS) setting to 8. In the Inspector, check On next to the Playing property and choose an Animation to see the animations in action:

Later, you'll write code to select between these animations, depending on what the player is doing. But first, you need to finish setting up the player's nodes.

主站蜘蛛池模板: 突泉县| 隆尧县| 新津县| 济源市| 岳阳市| 禄丰县| 河池市| 金昌市| 临湘市| 平塘县| 安康市| 石柱| 读书| 集贤县| 中阳县| 大宁县| 镶黄旗| 凤庆县| 四子王旗| 泽库县| 苏尼特左旗| 海安县| 和龙市| 郧西县| 葫芦岛市| 长顺县| 琼中| 涟源市| 高碑店市| 岑巩县| 康定县| 东辽县| 五家渠市| 江津市| 苍南县| 东丽区| 县级市| 额尔古纳市| 电白县| 易门县| 河西区|