{"author_url":"https://blog.hatena.ne.jp/syun77/","width":"100%","published":"2021-11-25 17:01:25","height":"190","provider_url":"https://hatena.blog","categories":["Godot"],"title":"\u3010Godot\u3011\u6587\u5b57\u5217\u3067\u5909\u6570\u3084\u95a2\u6570\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u65b9\u6cd5","type":"rich","url":"https://2dgames.jp/entry/godot-duck-typing/","blog_title":"2dgames.jp","blog_url":"https://2dgames.jp/","image_url":null,"version":"1.0","description":"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u6587\u5b57\u5217\u6307\u5b9a\u3067\u5909\u6570\u3084\u95a2\u6570\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u66f8\u304d\u307e\u3059\u3002 get() / set() \u3067\u5909\u6570\u3092\u64cd\u4f5c\u3059\u308b GDScript\u3067\u306f\u3001get() / set() \u3092\u4f7f\u3046\u3053\u3068\u3067\u6587\u5b57\u5217\u3067\u5909\u6570\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002 extends Node2D var hp = 1 func _ready(): print(\"hp: %d\"%hp) # \u6587\u5b57\u5217\u3067 \"hp\" \u304b\u3089\u5024\u3092\u53d6\u5f97\u3059\u308b print(\"hp: %d\"%get(\"hp\")) # \u6587\u5b57\u5217\u3067 \"hp\" \u306b\u5024\u3092\u8a2d\u5b9a\u3059\u308b set(\"hp\", 100) print(\"hp: %d\"%hp) \u5b9f\u884c\u7d50\u679c\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002 \u5b9f\u884c\u7d50\u679chp: 1 hp: 1 \u2026","author_name":"syun77","provider_name":"Hatena Blog","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2F2dgames.jp%2Fentry%2Fgodot-duck-typing%2F\" title=\"\u3010Godot\u3011\u6587\u5b57\u5217\u3067\u5909\u6570\u3084\u95a2\u6570\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u65b9\u6cd5 - 2dgames.jp\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>"}