{"id":188,"date":"2026-10-03T17:27:26","date_gmt":"2026-10-03T08:27:26","guid":{"rendered":"https:\/\/tate.stars.ne.jp\/wpa\/?p=188"},"modified":"2026-10-03T17:27:26","modified_gmt":"2026-10-03T08:27:26","slug":"joystickrenato-cassino","status":"publish","type":"post","link":"https:\/\/tate.stars.ne.jp\/wpa\/joystickrenato-cassino.html","title":{"rendered":"Joystick(Renato Cassino)"},"content":{"rendered":"<pre><code class=\"swift\">\nnpm install phaser-virtual-joystick\n\nimport { VirtualJoystick } from 'phaser-virtual-joystick';\n\nexport class GameScene extends Phaser.Scene {\n  private joystick!: VirtualJoystick;\n  private player!: Phaser.Physics.Arcade.Sprite;\n\ncreate() {\n this.joystick = new VirtualJoystick({\n   scene: this,\n   deadZone: {\n   radius: 30,\n   fillColor: 0x1a1a1a,\n   strokeColor: 0xcccccc,\n   alpha: 0.2\n  },\n   baseArea: {\n   radius: 100,\n   fillColor: 0x1a1a1a,\n   strokeColor: 0xcccccc,\n   alpha: 0.1\n},\n   stick: {\n   radius: 50,\n   fillColor: 0x666666,\n   strokeColor: 0x666666,\n   alpha: 0.5\n },\n enableWithoutTouch: true,\n bounds: {\n  topLeft: { x: 0, y: 10 },\n  bottomRight: {\n    x: this.scale.width * 0.8,\n    y: this.scale.height,\n },\n },\n stickIcon: this.add.text(-100, 0, '\ud83c\udfae', {\n   fontSize: '24px',\n   color: '#ffffff',\n   }),\n });\n this.joystick.setDepth(1);\n this.add.existing(this.joystick);\n        \nthis.player = this.physics.add.sprite(400, 300, 'player');\nthis.joystick.on('move', (data) => {\n this.player.setVelocity(\n  data.x * 200, \/\/ Move speed\n  data.y * 200\n );\n });\n\n this.joystick.on('release', () => {\n  this.player.setVelocity(0, 0);\n  });\n}\nupdate() {\n  this.joystick?.update();\n  }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>npm install phaser-virtual-joy&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3],"tags":[],"class_list":["post-188","post","type-post","status-publish","format-standard","hentry","category-phaser4","category-typescript"],"_links":{"self":[{"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/posts\/188","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=188"}],"version-history":[{"count":1,"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/posts\/188\/revisions"}],"predecessor-version":[{"id":189,"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/posts\/188\/revisions\/189"}],"wp:attachment":[{"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/media?parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/categories?post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tate.stars.ne.jp\/wpa\/wp-json\/wp\/v2\/tags?post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}