{"id":155,"date":"2026-07-15T14:45:13","date_gmt":"2026-07-15T05:45:13","guid":{"rendered":"https:\/\/tate.stars.ne.jp\/wpa\/?p=155"},"modified":"2026-07-15T14:45:13","modified_gmt":"2026-07-15T05:45:13","slug":"myplayer2bullet","status":"publish","type":"post","link":"https:\/\/tate.stars.ne.jp\/wpa\/myplayer2bullet.html","title":{"rendered":"myPlayer2Bullet"},"content":{"rendered":"<pre><code class=\"swift\">\nimport * as Phaser from 'phaser';\nexport class Bullet extends Phaser.Physics.Arcade.Sprite {\n constructor(scene: Phaser.Scene, x: number, y: number) {\n  super(scene, x, y, 'bullet');\n  scene.add.existing(this);\n  scene.physics.add.existing(this).setDepth(3);\n  scene.time.delayedCall(2000, this.destroyBullet, [], this);\n}\nprivate destroyBullet(): void {\n this.destroy();\n this.setVisible(false);\/\/bullet\u3092\u30b7\u30fc\u30f3\u304b\u3089\u524a\u9664\u3057\u3001\u30e1\u30e2\u30ea\u3092\u89e3\u653e\u3059\u308b\n }\n\/\/ \u5f3e\u3092\u767a\u5c04\u3059\u308b\u30e1\u30bd\u30c3\u30c9\nfire(x: number, y: number, direction: Phaser.Math.Vector2) {\n  this.enableBody(true, x, y, true, true);\n   const speed = 900; \/\/ \u5f3e\u306e\u901f\u5ea6\n   this.setVelocity(direction.x * speed, direction.y * speed);\n}\nupdate() {\nif (this.y < 0 || this.y > this.scene.scale.height ||\n   this.x < 0 || this.x > this.scene.scale.width) {\n   this.disableBody(true, true);\n }\n }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>import * as Phaser from &#8216;phase&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-155","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/posts\/155","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/comments?post=155"}],"version-history":[{"count":1,"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/posts\/155\/revisions"}],"predecessor-version":[{"id":156,"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/posts\/155\/revisions\/156"}],"wp:attachment":[{"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/media?parent=155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/categories?post=155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/tags?post=155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}