上QQ阅读APP看书,第一时间看更新
Node setup
Click Scene | New Scene and add the following nodes. Don't forget to set the children to not be selected, like you did with the Player scene:
- Area2D (named Coin)
- AnimatedSprite
- CollisionShape2D
Make sure to save the scene once you've added the nodes.
Set up the AnimatedSprite like you did in the Player scene. This time, you only have one animation: a shine/sparkle effect that makes the coin look less flat and boring. Add all the frames and set the Speed (FPS) to 12. The images are a little too large, so set the Scale of AnimatedSprite to (0.5, 0.5). In the CollisionShape2D, use a CircleShape2D and size it to cover the coin image. Don't forget: never use the scale handles when sizing a collision shape. The circle shape has a single handle that adjusts the circle's radius.