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

Node setup

Create a new scene and add a node named Main. To add the player to the scene, click the Instance button and select your saved Player.tscn:

Now, add the following nodes as children of Main, naming them as follows:

  • TextureRect (named Background)—for the background image
  • Node (named CoinContainer)—to hold all the coins
  • Position2D (named PlayerStart)—to mark the starting position of the Player
  • Timer (named GameTimer)—to track the time limit

Make sure Background is the first child node. Nodes are drawn in the order shown, so the background will be behind the player in this case. Add an image to the Background node by dragging the grass.jpg image from the assets folder into the Texture property. Change the Stretch Mode to Tile and then click Layout | Full Rect to size the frame to the size of the screen, as shown in the following screenshot:

Set the Position of the PlayerStart node to (240, 350).

Your scene layout should look like this:

主站蜘蛛池模板: 北碚区| 济宁市| 宁波市| 双辽市| 鹤山市| 浦北县| 天柱县| 囊谦县| 察哈| 滦南县| 临泉县| 华安县| 婺源县| 天台县| 宜都市| 无为县| 滦平县| 怀宁县| 肃宁县| 平武县| 伊川县| 密山市| 新沂市| 时尚| 岑溪市| 南昌市| 正定县| 旺苍县| 四子王旗| 秀山| 宜章县| 靖州| 金塔县| 苍山县| 温泉县| 克山县| 余庆县| 锡林郭勒盟| 宜宾县| 石楼县| 鹤山市|