ã¯ããã«
Godot 4.3 ãããåŸæ¥äœ¿ãããŠãã TileMap ã¯ã©ã¹ã DeprecatedïŒä»åŸããã¢ããããŒããããªãã£ãŠããšïŒã«ãªã£ãŠããã®ä»£ããã« TileMapLayer ã¯ã©ã¹ãæ°ãã«è¿œå ãããŸããããšããããšã§ãTileMapLayer ã§å®éã«ã¿ã€ã«ããããäœã£ãŠã¿ãããšæããŸãã
èšäºäœæåœæã®çè ã®ç°å¢
Godot ã®ããŒãžã§ã³: 4.3
ã³ã³ãã¥ãŒã¿ã®ã¢ãã«: MacBook Air M1, 2020
OS: macOS 14.6.1
ç»é¢ã®å€§ãããèšå®ãã
ä»å㯠16 x 16 px ã®ã¿ã€ã«ç»åã䜿ãã®ã§ãViewport ã¯å°ããã«ããŠã¿ã€ã«ãã¡ããã©åãŸããµã€ãºã«ããŸããããããžã§ã¯ããæ°èŠäœæãããããããžã§ã¯ãèšå® > äžè¬ã¿ã > Window ã§ä»¥äžã®ããã«èšå®ããŸããã
- Size:
- Viewport Width: 256
- Viewport Height: 160
- Window Width Override: 1024ïŒ4å
- Window Height Override: 640ïŒ4åïŒ
ããšã¯èšå®ããã«ãäžã«å°ãã¹ã¯ããŒã«ããŠãã¹ãã¬ããã¢ãŒãã viewport ã«ããŠã²ãŒã ã®çµµããŠã€ã³ããŠãµã€ãºã«åãããŠæ¡å€§ããããã«ããŸããã¢ã¹ãã¯ãæ¯ã¯ãã®ãŸãŸã«ããŠãããŸãã
- Stretch:
- Mode: viewport
- Aspect: keepïŒããã©ã«ãïŒ
- Scale: 1ïŒããã©ã«ãïŒ
- Scale Mode: fractionalïŒããã©ã«ãïŒ
ã¿ã€ã«çšã®ã¢ã»ãããã€ã³ããŒããã
KENNEY ã®ãµã€ã ãã 1-Bit Pack ãããŠã³ããŒããããŠããããŸãããããããã® 16 x 16 px ã¿ã€ã«ç»åã®è©°ãåããã§ãããã»ããšã«äœ¿ãããããŠæè¬ãããããŸãããã©ããããããšãããããŸããããŠã³ããŒãããã¢ã»ããã® TileSheet ã®ãã¡ colored-transparent_packed.png ã Godot ã®ãã¡ã€ã«ã·ã¹ãã ã«ã¶ã¡èŸŒã¿ãŸããã€ã³ããŒãã§ããŸããã
ã·ãŒã³ãäœã
ãšããããã·ãŒã³ãæ°èŠäœæããŸãããNode2D ãã«ãŒãã«ããŠååã World ã«ããŸããããã¿ãªååããããããããŠè¯ãã®ã§ãããããŠããã®åããŒãã« TileMapLayer ãè¿œå ããŸãããã³ã¬ãä»æ¥ã®ã¡ã€ã³ãã£ãã·ã¥ã§ããããŸãã
ã€ã³ã¹ãã¯ã¿ã§ TileMapLayer ã® Tile Set ããããã£ã«æ°ãã TileSet ãªãœãŒã¹ãè¿œå ããŸãã
TileSet ãäœã
TileSet ãšãã£ã¿ã§ã¿ã€ã«ã»ãããäœã£ãŠãããŸããã¡ãªã¿ã«ãé£ã® TileMap ãšãã£ã¿ãšèŠãç®ãã¡ãã£ãšäŒŒãŠããã®ã§ãããééããŸãããã¢ã¬ïŒã£ãŠãªã£ããããããããšã§ããããšã¯ Scene ããã¯ã§ TileMapLayer ããŒããéžæããç¶æ ãããªããšãšãã£ã¿ã®é ç®ã« TileSet ã TileMap ãåºãŠããªãã§ãããããã Godot ã«ãŸã æ £ããŠããªãããã¯è¬è§£ãã«æéãããããã®ã§ãïŒç§ã ãããïŒã
ããŠãTileSet ãšãã£ã¿ãéããããäžçªå·Šã®ç©ºã£ãœã®ãã€ã³ã«ãã¡ã€ã«ã·ã¹ãã ã«ããã€ã³ããŒãããã¿ã€ã«ã®ç»åããã©ãã°ããŠè¿œå ããŸãããã®æããã€ã¢ãã°ã衚瀺ãããŠãèªåã§ã¢ãã©ã¹ã«ã¿ã€ã«ãäœæãããèãããŸããå šéšã®ã¿ã€ã«ã䜿ãããã§ã¯ãªãã§ããã楜ã¡ããªã®ã§ Yes ãéžæããŠããŸããŸãã
ãããšãã€ã³ã¹ãã¯ã¿ã§æå®ããŠãããã¯ã¹ãã£é åã® 16 x 16 px ã«åãããŠãç»åãããç¯å²ããã¹ãŠ 16 x 16 px ã®ã¿ã€ã«ã«ããŠãããŸããã现ããªèšå®ã¯ãããããããŸãããã²ãšãŸãããã§ãçµµæãã®ããã®ãã¬ãããçšæã§ãããšããããã§ãã
TileMapLayer ãè€è£œãã
Godot 4.3 ãããã£ããã¯ã©ã¹åã« “Layer” ãã€ããã®ã§ãã¿ã€ã«ããããè€æ°ã®ã¬ã€ã€ãŒã«åããŠéããŠã¿ãããšæããŸãããããªããšããããŸã§ã® TileMap ã¯ã©ã¹ãšã®éãããããã«ããæ°ãããã®ã§ãã
ãšããããšã§ãScene ããã¯ã§æ¢åã® TileMapLayer ããŒãã2ã€è€è£œããŠãããããã®ããŒãã®ååã以äžã®ããã«ããŸããã
- TileMapGround
- TileMapGreen
- TileMapObject
ããã§ãçµµæããããã£ã³ãã¹ãã§ãããšããããšã§ããã
ã¿ã€ã«ããããäœã
TileMapGround
äžã®ã¬ã€ã€ãŒãããã£ãŠãããŸãããŸã㯠TileMapGround ããŒãã§ããããã«å°é¢ãæããŸãã2Dãšãã£ã¿ãäžéšã«è¡šç€ºãããŸãŸããã®äžã« TileMap ãšãã£ã¿ãéããŸããã¢ãã©ã¹ã«å°é¢ã£ãœãã¿ã€ã«ã4ã€ã»ã©ããã®ã§ãããããè€æ°éžæããŸããã
ãããŠããã®4ã€ã®ã¿ã€ã«ãã©ã³ãã ã§é 眮ãããã®ã«ãµã€ã³ãã¢ã€ã³ã³ãã¯ãªãã¯ããŠæå¹ã«ããŠãããŸãããéããªã£ããæå¹ã£ãŠããšã§ãã
ããšãç§ã®å Žåã¯ãã«ãŒãœã«åšãã®ã°ãªãããèŠããã»ããã¿ã€ã«ãé 眮ããããã®ã§ã°ãªãã衚瀺ãæå¹ã«ããŠãããŸããã
ç»é¢å šäœã«å°é¢ã®ã¿ã€ã«ãå¡ããŸãã®ã§ãåè§åœ¢ããŒã«ïŒå®éãååãªããŠèšããã ãïŒïŒãéžãã§ãããŸãããããå¡ããã£ãŠèšã£ã¡ãã£ãŠãŸãããè³ã¿ãããçµµæãã¢ãŒãã§ãã
ãããŠãç»é¢ãµã€ãºã®å³äžè§ããå·Šäžè§ (0, 0) ã«åãã£ãŠç¯å²éžæããããã«ãã©ãã°ãããšãäžæ°ã«ã¿ã€ã«ãé 眮ãããŸãã
å°é¢ã®ã¿ã€ã«ããããå®æããŸããã
ããŠããã®èª¿å㧠TileMapGreen ã«èæšã®ã¿ã€ã«ãé 眮ããŠãTileMapObject ã«ãå¢ã§ã建ãŠãŸããããäœæ¥æé ã¯ãã説æäžèŠã§ããã§ãããïŒïŒ
TileMapGreen ãããŸãããã
TileMapGreen
ãŸãç»é¢ã®å€åšãããã£ãšæšã ã§å²ããããšæããŸããããã€ãã®æšã®ã¿ã€ã«ããµã€ã³ãæ¯ã£ãŠã©ã³ãã ã«é 眮ããŸããããã
ããšæšã ã®å åŽã«èãçããããã®ã§ããŸãããã€ãèã®ããã«ãéžæããŠãµã€ã³ããæ¯ãã€ã€å¡ããŸãwwwïŒããã©ãã§ç¬ãããïŒ
ã¡ãªã¿ã«ãå€åšã«ããããªæšãé 眮ããäœæ¥ã¯ã©ã€ã³ããŒã«ã䟿å©ã§ããã现ãé·ãã¿ã€ã«ãé 眮ããæã«äœ¿ããšè¯ãããã§ããã
èæšãçãããŠããããªæãã«ãªããŸãããå°é¢ã®ã¿ã€ã«ãšéãªã£ãŠããã®ããããã§ããããïŒïŒã¡ãã£ãšãããã«ããããïŒïŒ
ã¡ãªã¿ã«ãéèã®å¡ãã«å€±æããŠãæ¶ããŽã ããŒã«ã§æ¶ãããšãã«ãäžã® TileMapGround ããŒãã®å°é¢ã¿ã€ã«ã¯æ¶ããªãã®ã§ããããã¯ããã¯ãªã¹ã¿ãšãGIMPã«æ £ããŠãã人ã«ã¯éåžžã«è¯ããšæããŸãã
TileMapObject
æåŸã« TileMapObject ã«ã¯ãå¢ã建ãŠãŸããããå¢ã®ã¿ã€ã«ãããã€ãããã®ã§ããŸãè€æ°éžæããŠãµã€ã³ãæ¯ããªããå¡ããšããŸãããã
ãã³ãã€ã³ãã§ããããã¿ã€ã«ãé 眮ããå Žåã¯ãã³ããŒã«ã䟿å©ã§ãããçµµã®æãæ¹ã§ãããšç¹æãããªãã³ã¬ãã£ãŠæãã§ãã
ç«æŽŸãªãå¢ã建ã¡ãŸããïŒç«æŽŸãã©ããããããïŒã
ãããžã§ã¯ããå®è¡ãã
ã·ãŒã³ããŸã äžåºŠãä¿åããŠããŸããã§ãããããããžã§ã¯ããå®è¡ããŠå®éã®ã²ãŒã ç»é¢ã確èªããŠã¿ãŸãããåé¡ãªãã§ãããããã§å®æã§ãããïŒã©ããã§ã¿ãããšããçµµã§ãã£ãŠïŒã¯ã¯ãããåè«ãã
ãããã«
ä»å㯠Godot 4.3 ã§ç»å Žãã TileMapLayer ã¯ã©ã¹ã䜿ã£ãŠåºæ¬çãªã¿ã€ã«ãããã®äœãæ¹ã確èªããŸãããã¿ã€ã«ãããã®ç·šéæ¹æ³ã¯ãåŸæ¥ã® TileMap ããŒããã倧ãã䜿ãæ¹ãå€ããããã§ã¯ãªãããã§ãããåŸæ¥ã® TileMap ã¯ã©ã¹ã ãšãã¿ã€ã«ãããåºæã®æ å ±ãšããŠã¬ã€ã€ãŒãèšå®ã§ããŸããããTileMapLayer ã䜿ããšãä»ã®ã¯ã©ã¹ã®ããŒããšåãããã« Scene ããã¯ã§ããŒãã管çã§ããŠãçŽæçã«ãšã£ãŠããããããããªã£ãã®ã§ã¯ãªãããšæããŸããTileMap ã¯ã©ã¹ã Deprecated ãªã®ã§ããããã«ãããä»åŸã¯ TileMapLayer ã¯ã©ã¹ã®æ±ãã«æ £ããã®ãåãšããæããããŸãã以äžã§ããããŸãã