{"id":6110,"date":"2020-10-30T16:39:02","date_gmt":"2020-10-30T07:39:02","guid":{"rendered":"https:\/\/www.lancard.com\/blog\/?p=6110"},"modified":"2025-03-12T11:25:24","modified_gmt":"2025-03-12T02:25:24","slug":"phaser3","status":"publish","type":"post","link":"https:\/\/www.lancard.com\/blog\/2020\/10\/30\/phaser3\/","title":{"rendered":"Phaser3\u3067\u30b9\u30d7\u30e9\u30a4\u30c8\u753b\u50cf\u3092\u4f7f\u3046"},"content":{"rendered":"\nPhaser3\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u7db2\u7f85\u7684\u3067\u3082\u8aac\u660e\u7684\u3067\u3082\u306a\u304f\u3001\u5b9f\u969b\u306b\u52d5\u304f\u3082\u306e\u3092\u305d\u306e\u307e\u307e\u653e\u308a\u8fbc\u3093\u3060\u3088\u3046\u306a\u3082\u306e\u306a\u306e\u3067\u8a73\u7d30\u304c\u7121\u304f\u3066\u5fdc\u7528\u304c\u3057\u306b\u304f\u3044\u3067\u3059\u3002<br>\uff08\u8a2d\u5b9a\u306e\u7a2e\u985e\u5225\u306b\u8868\u793a\u3059\u308b\u3067\u3082\u306a\u304f\u3001\u8a2d\u5b9a\u306e\u4e2d\u8eab\u3092\u8aac\u660e\u3059\u308b\u3067\u3082\u306a\u304f\u30ea\u30f3\u30af\u3082\u7121\u304f\u3001\u3068\u306b\u304b\u304f\u52d5\u304f\u305e\uff01\u3068\u3044\u3046\u611f\u3058\uff09<br><br>\u4f55\u3068\u304b\u52d5\u304f\u3088\u3046\u306b\u306a\u308b\u307e\u3067\u306e\u7d4c\u7def\u304c\u4ee5\u4e0b\u3002\n\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n\n<!--more-->\n\n\n\n\n<h2 class=\"wp-block-heading\">Phaser3\u306e\u30b5\u30f3\u30d7\u30eb\u9078\u629e<\/h2>\n\n\n\n\n\u5206\u5272\u8868\u793a\u3059\u308b\u4f8b\u306e\u4e2d\u3067\u3001\u4e01\u5ea6\u826f\u3055\u305d\u3046\u306a\u3053\u308c\u3092\u4f7f\u3044\u307e\u3059\u3002<br><a href=\"https:\/\/phaser.io\/examples\/v3\/view\/input\/game-object\/destroy-sprite-on-down-event\">https:\/\/phaser.io\/examples\/v3\/view\/input\/game-object\/destroy-sprite-on-down-event<\/a>\n\n\n\n\n<h3 class=\"wp-block-heading\">\u30b9\u30d7\u30e9\u30a4\u30c8\u8868\u793a\u3059\u308b\u753b\u50cf<\/h3>\n\n\n\n\n\u4eca\u56de\u306fPixabay\u304b\u3089 <a href=\"https:\/\/pixabay.com\/ja\/vectors\/%E3%82%AB%E3%83%BC%E3%83%89-%E3%83%87%E3%83%83%E3%82%AD-%E3%83%87%E3%83%83%E3%82%AD-%E3%82%AB%E3%83%BC%E3%83%89-161536\/\">https:\/\/pixabay.com\/ja\/vectors\/%E3%82%AB%E3%83%BC%E3%83%89-%E3%83%87%E3%83%83%E3%82%AD-%E3%83%87%E3%83%83%E3%82%AD-%E3%82%AB%E3%83%BC%E3%83%89-161536\/<\/a><br><br>\u4e00\u679a\u304c\u6a2a70px\u306b\u306a\u308b\u3088\u3046\u6a2a910px\u3001\u7e26545px\u306b\u66f4\u65b0\u3057\u307e\u3059\u3002\n\n\n\n\n<h3 class=\"wp-block-heading\">\u5206\u5272\u5b9a\u7fa9\u3057\u305f JSON<\/h3>\n\n\n\n\nload.atlas()\u304b\u3089\u5206\u5272\u3092\u5b9a\u7fa9\u3059\u308bjson\u30d5\u30a1\u30a4\u30eb\u304c\u5fc5\u8981\u306a\u306e\u3060\u3068\u5224\u65ad\u3002\u30b5\u30f3\u30d7\u30eb\u3092\u8ffd\u3063\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u4e00\u500b\u4e00\u500b\u4f5c\u308b\u306e\u306f\u9762\u5012\u306a\u306e\u3067PHP\u3067\u30a2\u30a6\u30c8\u30d7\u30c3\u30c8\u51fa\u6765\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<br>\u5404\u9805\u76ee\u306b\u95a2\u3057\u3066\u8aac\u660e\u304c\u7121\u3044\u306e\u3067\u3001\u3069\u308c\u304c\u3069\u3046\u3044\u3046\u52d5\u304d\u306b\u306a\u308b\u304b\u306f\u81ea\u5206\u3067\u3044\u3058\u3063\u3066\u78ba\u8a8d\u3059\u308b\u3057\u304b\u306a\u3044\u3067\u3059\u3002\n\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n{\n    $Symbols = array(\n        \"club\",\n        \"dia\",\n        \"heart\",\n        \"spade\",\n    );\n    $width = 70;\n    $height = 109;\n    $margin = 0;\n    $bodyMarginX = $bodyMarginY = 0;\n}\n\/\/\n$Json = array();\nforeach($Symbols as $snum => $sym){\n    for($c=1;$c&lt;=13;$c++){\n        $Json&#91;] = array(\n            \"filename\"=>$sym.$c,\n            \"frame\"=>array(\n                \"x\"=>($c-1)*($width+$margin)+$bodyMarginX,\n                \"y\"=>$snum*($height+$margin)+$bodyMarginY,\n                \"w\"=>$width, \"h\"=>$height\n            ),\n            \"rotated\"=>false,\n            \"trimmed\"=>false,\n            \"spriteSourceSize\"=>array(\"x\"=>0, \"y\"=>0, \"w\"=>$width, \"h\"=>$height),\n            \"sourceSize\"=>array(\"w\"=>$width, \"h\"=>$height),\n        );\n    }\n}\n{   \/\/ \u88cf\u5074\n    $Json&#91;] = array(\n        \"filename\"=>\"back\",\n        \"frame\"=>array(\n            \"x\"=>2*($width+$margin)+$bodyMarginX,\n            \"y\"=>4*($height+$margin)+$bodyMarginY,\n            \"w\"=>$width, \"h\"=>$height\n        ),\n        \"rotated\"=>false,\n        \"trimmed\"=>false,\n        \"spriteSourceSize\"=>array(\"x\"=>0, \"y\"=>0, \"w\"=>$width, \"h\"=>$height),\n        \"sourceSize\"=>array(\"w\"=>$width, \"h\"=>$height),\n    );\n}\n$JsonFrame = array(\"frames\"=>$Json);\n$STR = json_encode($JsonFrame, JSON_PRETTY_PRINT);\nfile_put_contents(\"fronts2.json\", $STR);<\/code><\/pre>\n\n\n\n\n\n<h3 class=\"wp-block-heading\">Phaser<\/h3>\n\n\n\n\n\u753b\u50cf\u3092img\/fronts2.png, \u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u3092js\/fronts2.json\u306b\u8a2d\u7f6e\u3057\u3001<br>preload\u3067\u8aad\u8fbc\n\n\n\n\n<pre class=\"wp-block-code\"><code>function preload (){\n    this.load.atlas('fronts', 'img\/fronts2.png', 'js\/fronts2.json');\n}<\/code><\/pre>\n\n\n\n\ncreate\u3067\u8868\u793a\n\n\n\n\n<pre class=\"wp-block-code\"><code> function create (){\n    var scene = this;\n    var frames = scene.textures.get('fronts').getFrameNames();\n    for(var s=1;s&lt;=4;s++){\n        for(var c=1;c&lt;=13;c++){\n            var x = c * 75 - 30;\n            var y = s * 114 - 50;\n            var fname = frames&#91;(s-1)*13+c-1];\n            scene.add.image(x, y, 'fronts', fname);\n        }\n    }\n    var back = scene.add.image(45, 500, 'fronts', 'back');\n}<\/code><\/pre>\n\n\n\n\n\u5206\u5272\u3057\u3066\u8868\u793a\u3055\u308c\u305f\u7d50\u679c\u304c\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"335\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/uploads\/2020\/10\/image-2-602x335.png\" alt=\"\" class=\"wp-image-6112\" srcset=\"https:\/\/www.lancard.com\/blog\/wp-content\/uploads\/2020\/10\/image-2-602x335.png 602w, https:\/\/www.lancard.com\/blog\/wp-content\/uploads\/2020\/10\/image-2-400x223.png 400w, https:\/\/www.lancard.com\/blog\/wp-content\/uploads\/2020\/10\/image-2-768x428.png 768w, https:\/\/www.lancard.com\/blog\/wp-content\/uploads\/2020\/10\/image-2.png 1323w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n<a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-facebook nolightbox\" data-provider=\"facebook\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Facebook\" href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F6110&#038;t=Phaser3%E3%81%A7%E3%82%B9%E3%83%97%E3%83%A9%E3%82%A4%E3%83%88%E7%94%BB%E5%83%8F%E3%82%92%E4%BD%BF%E3%81%86&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F6110&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-content%2Fuploads%2F2020%2F10%2Fimage-2-602x335.png&#038;p&#091;title&#093;=Phaser3%E3%81%A7%E3%82%B9%E3%83%97%E3%83%A9%E3%82%A4%E3%83%88%E7%94%BB%E5%83%8F%E3%82%92%E4%BD%BF%E3%81%86\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"Facebook\" title=\"Share on Facebook\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/facebook.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-twitter nolightbox\" data-provider=\"twitter\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Twitter\" href=\"http:\/\/twitter.com\/share?url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F6110&#038;text=Phaser3%E3%81%A7%E3%82%B9%E3%83%97%E3%83%A9%E3%82%A4%E3%83%88%E7%94%BB%E5%83%8F%E3%82%92%E4%BD%BF%E3%81%86\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"twitter\" title=\"Share on Twitter\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/twitter.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-linkedin nolightbox\" data-provider=\"linkedin\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Linkedin\" href=\"https:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F6110&#038;title=Phaser3%E3%81%A7%E3%82%B9%E3%83%97%E3%83%A9%E3%82%A4%E3%83%88%E7%94%BB%E5%83%8F%E3%82%92%E4%BD%BF%E3%81%86\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"linkedin\" title=\"Share on Linkedin\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/linkedin.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-tumblr nolightbox\" data-provider=\"tumblr\" target=\"_blank\" rel=\"nofollow\" title=\"Share on tumblr\" href=\"https:\/\/tumblr.com\/share?s=&#038;v=3&#038;t=Phaser3%E3%81%A7%E3%82%B9%E3%83%97%E3%83%A9%E3%82%A4%E3%83%88%E7%94%BB%E5%83%8F%E3%82%92%E4%BD%BF%E3%81%86&#038;u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F6110\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"tumblr\" title=\"Share on tumblr\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/tumblr.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-mail nolightbox\" data-provider=\"mail\" rel=\"nofollow\" title=\"Share by email\" href=\"mailto:?subject=Phaser3%E3%81%A7%E3%82%B9%E3%83%97%E3%83%A9%E3%82%A4%E3%83%88%E7%94%BB%E5%83%8F%E3%82%92%E4%BD%BF%E3%81%86&#038;body=%E3%82%B7%E3%82%A7%E3%82%A2%E3%81%99%E3%82%8B%EF%BC%9A:%20https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F6110\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"mail\" title=\"Share by email\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/mail.png\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>Phaser3\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u7db2\u7f85\u7684\u3067\u3082\u8aac\u660e\u7684\u3067\u3082\u306a\u304f\u3001\u5b9f\u969b\u306b\u52d5\u304f\u3082\u306e\u3092\u305d\u306e\u307e\u307e\u653e\u308a\u8fbc\u3093\u3060\u3088\u3046\u306a\u3082\u306e\u306a\u306e\u3067\u8a73\u7d30\u304c\u7121\u304f\u3066\u5fdc\u7528\u304c\u3057\u306b\u304f\u3044\u3067\u3059\u3002\uff08\u8a2d\u5b9a\u306e\u7a2e\u985e\u5225\u306b\u8868\u793a\u3059\u308b\u3067\u3082\u306a\u304f\u3001\u8a2d\u5b9a\u306e\u4e2d\u8eab\u3092\u8aac\u660e\u3059\u308b\u3067\u3082\u306a\u304f\u30ea\u30f3\u30af\u3082\u7121\u304f\u3001\u3068\u306b\u304b\u304f\u52d5 [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6110","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/6110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/comments?post=6110"}],"version-history":[{"count":14,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/6110\/revisions"}],"predecessor-version":[{"id":6126,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/6110\/revisions\/6126"}],"wp:attachment":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/media?parent=6110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/categories?post=6110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/tags?post=6110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}