Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import or require. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <canvas id="cvs" width="400" height="400"></canvas>
            
          
!
            
              body { background-color: #FFFFFF; }
            
          
!
            
              // forked from siouxcitizen's "前回コードから障害物に引っかかる?機能を追加しました" http://jsdo.it/siouxcitizen/hot8
//
//前回コードから勇者の移動をなめらか?にしました
//
//引き続きWonderflの以下のコードのような実装を目指してみました。勇者の移動がなめらか?になっただけですが。。。
//ワンダフルクエスト
//http://wonderfl.net/c/wu8f
//↑画像データは上記コードからのものを使用させてもらっています
//
//以下コードをbase64画像への変換に使用させていただきました
//2009-3-14 選んだファイルを Base64 エンコードする
//http://wonderfl.net/c/h1NU
//
var canvas;
var ctx;

var sunaImg; //砂
var shibafuImg; //芝生
var mizuImg; //水
var sabotenImg; //サボテン
var makkuraImg; //真っ暗

//勇者用
var yuusha;
var yuushaFrontImgOne; //勇者前向き1
var yuushaFrontImgTwo; //勇者前向き2
var yuushaBackImgOne;  //勇者後ろ向き1
var yuushaBackImgTwo;  //勇者後ろ向き2
var yuushaLeftImgOne;  //勇者左向き1
var yuushaLeftImgTwo;  //勇者左向き2
var yuushaRightImgOne; //勇者右向き1
var yuushaRightImgTwo; //勇者右向き2
//var SCALE = 1; //勇者やフィールドの拡大率
var SPEED = 2; //勇者が歩くスピード FLDSIZEの約数にしてください
var MAPSIZE = 16; //マップの横・縦のマスの個数
var FLDSIZE = 16; //フィールド(マップ上の1マス)の横・縦のドット数
var yuushaMapXPos = MAPSIZE/2; //マップのマス数であわらした勇者X位置
var yuushaMapYPos = MAPSIZE/2; //マップのマス数であわらした勇者Y位置
var walkDirection = 4; //歩いていく方向 (0~3:下上左右  4:止)
var keyFlags = [false, false, false, false];

//0:砂漠 1:芝生 2:水 3:サボテン
var mapData = [[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
              [ 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2],
              [ 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2],
              [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
var bMapData = []; //フィールドが障害物か否かを記憶

window.onload = function () {
  setImageData();
  init();
}

function init() {
  canvas = document.getElementById("cvs");
  if (!canvas) return false;
  canvas.width = 400;
  canvas.height = 400;
  ctx= canvas.getContext("2d");
  if(!ctx) return false;

  createMap();

  yuusha = new Yuusha(canvas, SPEED, FLDSIZE*yuushaMapXPos, FLDSIZE*yuushaMapYPos);

  //キーが押された時のイベントを処理
  document.addEventListener('keydown', handleKeyDown, false);
  //キーが離された時のイベントを処理
  document.addEventListener('keyup', handleKeyUp, false);

  setInterval(loop, 10);
}

//キーボードのキーが押された時の処理
function handleKeyDown(event) {
  if (event.keyCode==40 || event.keyCode==83) {//↓ s ボタン
    keyFlags[0] = true;
  } else if (event.keyCode==38 || event.keyCode==87) {//↑ w ボタン
    keyFlags[1] = true;
  } else if (event.keyCode==37 || event.keyCode==65) {//← a ボタン
    keyFlags[2] = true;
  } else if (event.keyCode==39 || event.keyCode==68) {//→ d ボタン
    keyFlags[3] = true;
  }
}
//キーボードのキーが離された時の処理
function handleKeyUp(event) {
  if (event.keyCode==40 || event.keyCode==83) {//↓ s ボタン
    keyFlags[0] = false;
  } else if (event.keyCode==38 || event.keyCode==87) {//↑ w ボタン
    keyFlags[1] = false;
  } else if (event.keyCode==37 || event.keyCode==65) {//← a ボタン
    keyFlags[2] = false;
  } else if (event.keyCode==39 || event.keyCode==68) {//→ d ボタン
    keyFlags[3] = false;
  }
}

function loop() {
  //保持したマップを再描画
  ctx.putImageData(mapImg, 0, 0);
  //勇者画像表示
  if (yuusha.x % FLDSIZE == 0 && yuusha.y % FLDSIZE == 0) {
    //var mapPosX = yuusha.x / FLDSIZE, mapPosY = yuusha.y / FLDSIZE;
    walkDirection = 4;         //止まる
    if (keyFlags[0]) {//↓ボタン押下
      if (yuushaMapYPos < 15 && !bMapData[yuushaMapYPos+1][yuushaMapXPos]) {
        walkDirection = 0; 
        yuushaMapYPos++;
      }
      yuusha.walkDirection = 0;
    } else if (keyFlags[1]) {//↑ボタン押下
      if (yuushaMapYPos > 0 && !bMapData[yuushaMapYPos-1][yuushaMapXPos]) {
        walkDirection = 1; 
        yuushaMapYPos--;
      }
      yuusha.walkDirection = 1;
    } else if (keyFlags[2]) {//←ボタン押下
      if (yuushaMapXPos > 0 && !bMapData[yuushaMapYPos][yuushaMapXPos-1]) {
        walkDirection = 2; 
        yuushaMapXPos--;
      }
      yuusha.walkDirection = 2;
    } else if (keyFlags[3]) {//→ボタン押下
      if (yuushaMapXPos < 15 && !bMapData[yuushaMapYPos][yuushaMapXPos+1]) {
        walkDirection = 3; 
        yuushaMapXPos++;
      }
      yuusha.walkDirection = 3;
    }
  }

  //次のマスまで自動的に勇者を歩かせる
  if(walkDirection == 0) {
    yuusha.y += SPEED;
  } else if (walkDirection == 1) {
    yuusha.y -= SPEED;
  } else if (walkDirection == 2) {
    yuusha.x -= SPEED;
  } else if (walkDirection == 3) {
    yuusha.x += SPEED;
  }
  yuusha.walk();
  //if (walkDirection < 4) yuusha.move();
}

function createMap() {
  for (k = 0; k < MAPSIZE; k++) bMapData[k] = []; //bMapDataを2次元配列にする

  for (j = 0; j < MAPSIZE; j++){
    for (i = 0; i < MAPSIZE; i++){
      var imgPosX = FLDSIZE * i;
      var imgPosY = FLDSIZE * j;
      var isObstacle;
      if ([mapData[j][i]] == 0) {
        ctx.drawImage(sunaImg, imgPosX, imgPosY);
        bMapData[j][i] = false;
      } else if ([mapData[j][i]] == 1) {
        ctx.drawImage(shibafuImg, imgPosX, imgPosY);
        bMapData[j][i] = false;
      } else if ([mapData[j][i]] == 2) {
        ctx.drawImage(mizuImg, imgPosX, imgPosY);
        bMapData[j][i] = true;
      } else if ([mapData[j][i]] == 3) {
        ctx.drawImage(sabotenImg, imgPosX, imgPosY);
        bMapData[j][i] = true;
      } else if ([mapData[j][i]] == 4) {
        ctx.drawImage(makkuraImg, imgPosX, imgPosY);
        bMapData[j][i] = true;
      }
      //マップをまとめて保持
      mapImg = ctx.getImageData(0, 0, MAPSIZE*FLDSIZE, MAPSIZE*FLDSIZE);
    }
  }
}

//勇者クラス
var Yuusha = function(canvas,speed,x,y) {
  this.speed = speed;
  this.x = x;
  this.y = y;
  this.frameCount = 0;
  this.walkFlag = true; //足踏み用
  this.walkDirection = 0; //歩いていく方向 (0~3:下上左右)
  this.canvas = canvas;
  this.ctx = canvas.getContext('2d');
}
Yuusha.prototype.walk = function() {
  this.ctx.save();

  if (this.frameCount++ > 15) { //
    this.frameCount = 0;
    this.walkFlag = !this.walkFlag;
  } 
  if(this.walkFlag) { //足踏み表現
    if(this.walkDirection == 0) { //勇者画像1による足踏み
      this.ctx.drawImage(yuushaFrontImgOne,this.x,this.y);
    } else if (this.walkDirection == 1) {
      this.ctx.drawImage(yuushaBackImgOne,this.x,this.y);
    } else if (this.walkDirection == 2) {
      this.ctx.drawImage(yuushaLeftImgOne,this.x,this.y);
    } else if (this.walkDirection == 3) {
      this.ctx.drawImage(yuushaRightImgOne,this.x,this.y);
    } 
  } else {
    if(this.walkDirection == 0) { //勇者画像2による足踏み
      this.ctx.drawImage(yuushaFrontImgTwo,this.x,this.y);
    } else if (this.walkDirection == 1) {
      this.ctx.drawImage(yuushaBackImgTwo,this.x,this.y);
    } else if (this.walkDirection == 2) {
      this.ctx.drawImage(yuushaLeftImgTwo,this.x,this.y);
    } else if (this.walkDirection == 3) {
      this.ctx.drawImage(yuushaRightImgTwo,this.x,this.y);
    } 
  }

  this.ctx.restore();
}

function setImageData() {
  //砂
  sunaImg = new Image();
  sunaImg.src =  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAANklEQVQokWP4v8MDE+2sYsAqDkQ4JaigAWItA34H0NdJg0ED1sAYYn4goIHI+CZKEbJZJDsJAExt+khTZWqXAAAAAElFTkSuQmCC";
  //芝生
  shibafuImg = new Image();
  shibafuImg.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAANElEQVQokWOYdIcBExlOwyIIQTglqKABYi0BB9DXSYNBA9bAGGJ+IKCByPgmShGyWSQ7CQCHEmomoGsXjwAAAABJRU5ErkJggg==";
  //水
  mizuImg = new Image();
  mizuImg.src =  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAAcUlEQVQokZWSwQ2AMAwDvS/bsAlLMAUvFimRLIXQummQ/GivUWpHwXY27JfpuJvJDkYoyeGUd765BI8NvI4VkmNszOuMI7ErOTK7kid2JUdiV3JUZh85SrMPHEvTPa/M/sOLK/T+WV2hGPpXjD70MsYDrQTzsOkaBq4AAAAASUVORK5CYII=";
  //サボテン
  sabotenImg = new Image();
  sabotenImg.src =  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEUAAACAAAAAgACAgAAAAICAAIAAgIDAwMDA3MCmyvD/8NT/4rH/1I7/xmv/uEj/qiX/qgDckgC5egCWYgBzSgBQMgD/49T/x7H/q47/j2v/c0j/VyX/VQDcSQC5PQCWMQBzJQBQGQD/1NT/sbH/jo7/a2v/SEj/JSX+AADcAAC5AACWAABzAABQAAD/1OP/scf/jqv/a4//SHP/JVf/AFXcAEm5AD2WADFzACVQABn/1PD/seL/jtT/a8b/SLj/Jar/AKrcAJK5AHqWAGJzAEpQADL/1P//sf//jv//a///SP//Jf/+AP7cANy5ALmWAJZzAHNQAFDw1P/isf/Ujv/Ga/+4SP+qJf+qAP+SANx6ALliAJZKAHMyAFDj1P/Hsf+rjv+Pa/9zSP9XJf9VAP9JANw9ALkxAJYlAHMZAFDU1P+xsf+Ojv9ra/9ISP8lJf8AAP4AANwAALkAAJYAAHMAAFDU4/+xx/+Oq/9rj/9Ic/8lV/8AVf8ASdwAPbkAMZYAJXMAGVDU8P+x4v+O1P9rxv9IuP8lqv8Aqv8AktwAerkAYpYASnMAMlDU//+x//+O//9r//9I//8l//8A/v4A3NwAubkAlpYAc3MAUFDU//Cx/+KO/9Rr/8ZI/7gl/6oA/6oA3JIAuXoAlmIAc0oAUDLU/+Ox/8eO/6tr/49I/3Ml/1cA/1UA3EkAuT0AljEAcyUAUBnU/9Sx/7GO/45r/2tI/0gl/yUA/gAA3AAAuQAAlgAAcwAAUADj/9TH/7Gr/46P/2tz/0hX/yVV/wBJ3AA9uQAxlgAlcwAZUADw/9Ti/7HU/47G/2u4/0iq/yWq/wCS3AB6uQBilgBKcwAyUAD//9T//7H//47//2v//0j//yX+/gDc3AC5uQCWlgBzcwBQUADy8vLm5uba2trOzs7CwsK2traqqqqenp6SkpKGhoZ6enpubm5iYmJWVlZKSko+Pj4yMjImJiYaGhoODg7/+/CgoKSAgID/AAAA/wD//wAAAP//AP8A///////g951TAAABAHRSTlP/AP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////rTvmKwAAAFxJREFUGJVtj8ENwDAIA2+C7r8R725UbCAiUvNIiM8gw1MHpugngiWQ/3hZDilHUHc5EE6WSIKBOIl6hqBr8RLAd2tud+PYelLlki/NVzDsP8l/krIEz7u2Zfb/AKt1Pp87jJKZAAAAAElFTkSuQmCC";
  //真っ暗
  makkuraImg = new Image();
  makkuraImg.src =  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGElEQVQ4jWNgYGD4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zs7CwsK2traqqqqenp6SkpKGhoZ6enpubm5iYmJWVlZKSko+Pj4yMjImJiYaGhoODg7/+/CgoKSAgID/AAAA/wD//wAAAP//AP8A///////g951TAAABAHRSTlP/AP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////rTvmKwAAAF5JREFUGJVNz4sNACEIA1CYotMye698vSYm8oKK5nQlKrmzAhVkywAJiA7YR7igPQKoMwNV48AX7g6Jopq0mNSzWuZ6L06BhJLXkTexB2OB/0fng/keG7LbYybdBu98alNb5ZfPFBgAAAAASUVORK5CYII=";
  //勇者前向き2
  yuushaFrontImgTwo = new Image();
  yuushaFrontImgTwo.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEUAAACAAAAAgACAgAAAAICAAIAAgIDAwMDA3MCmyvD/8NT/4rH/1I7/xmv/uEj/qiX/qgDckgC5egCWYgBzSgBQMgD/49T/x7H/q47/j2v/c0j/VyX/VQDcSQC5PQCWMQBzJQBQGQD/1NT/sbH/jo7/a2v/SEj/JSX+AADcAAC5AACWAABzAABQAAD/1OP/scf/jqv/a4//SHP/JVf/AFXcAEm5AD2WADFzACVQABn/1PD/seL/jtT/a8b/SLj/Jar/AKrcAJK5AHqWAGJzAEpQADL/1P//sf//jv//a///SP//Jf/+AP7cANy5ALmWAJZzAHNQAFDw1P/isf/Ujv/Ga/+4SP+qJf+qAP+SANx6ALliAJZKAHMyAFDj1P/Hsf+rjv+Pa/9zSP9XJf9VAP9JANw9ALkxAJYlAHMZAFDU1P+xsf+Ojv9ra/9ISP8lJf8AAP4AANwAALkAAJYAAHMAAFDU4/+xx/+Oq/9rj/9Ic/8lV/8AVf8ASdwAPbkAMZYAJXMAGVDU8P+x4v+O1P9rxv9IuP8lqv8Aqv8AktwAerkAYpYASnMAMlDU//+x//+O//9r//9I//8l//8A/v4A3NwAubkAlpYAc3MAUFDU//Cx/+KO/9Rr/8ZI/7gl/6oA/6oA3JIAuXoAlmIAc0oAUDLU/+Ox/8eO/6tr/49I/3Ml/1cA/1UA3EkAuT0AljEAcyUAUBnU/9Sx/7GO/45r/2tI/0gl/yUA/gAA3AAAuQAAlgAAcwAAUADj/9TH/7Gr/46P/2tz/0hX/yVV/wBJ3AA9uQAxlgAlcwAZUADw/9Ti/7HU/47G/2u4/0iq/yWq/wCS3AB6uQBilgBKcwAyUAD//9T//7H//47//2v//0j//yX+/gDc3AC5uQCWlgBzcwBQUADy8vLm5uba2trOzs7CwsK2traqqqqenp6SkpKGhoZ6enpubm5iYmJWVlZKSko+Pj4yMjImJiYaGhoODg7/+/CgoKSAgID/AAAA/wD//wAAAP//AP8A///////g951TAAABAHRSTlP/AP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////rTvmKwAAAGNJREFUGJVVkNERAEEEQ6ki1ao9l7DMnJ/lDREb2VEdzmJrckgkDUhA6ABnhAuUo4CeeaBrHMgFpyGikDQNRlGPE7rj7SitBsMb+OsA5OMZO/Csq0mitaeN1dhbPca79n4g8wOB+V8BcL2yOAAAAABJRU5ErkJggg==";

  //勇者後ろ向き1
  yuushaBackImgOne = new Image();
  yuushaBackImgOne.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEUAAACAAAAAgACAgAAAAICAAIAAgIDAwMDA3MCmyvD/8NT/4rH/1I7/xmv/uEj/qiX/qgDckgC5egCWYgBzSgBQMgD/49T/x7H/q47/j2v/c0j/VyX/VQDcSQC5PQCWMQBzJQBQGQD/1NT/sbH/jo7/a2v/SEj/JSX+AADcAAC5AACWAABzAABQAAD/1OP/scf/jqv/a4//SHP/JVf/AFXcAEm5AD2WADFzACVQABn/1PD/seL/jtT/a8b/SLj/Jar/AKrcAJK5AHqWAGJzAEpQADL/1P//sf//jv//a///SP//Jf/+AP7cANy5ALmWAJZzAHNQAFDw1P/isf/Ujv/Ga/+4SP+qJf+qAP+SANx6ALliAJZKAHMyAFDj1P/Hsf+rjv+Pa/9zSP9XJf9VAP9JANw9ALkxAJYlAHMZAFDU1P+xsf+Ojv9ra/9ISP8lJf8AAP4AANwAALkAAJYAAHMAAFDU4/+xx/+Oq/9rj/9Ic/8lV/8AVf8ASdwAPbkAMZYAJXMAGVDU8P+x4v+O1P9rxv9IuP8lqv8Aqv8AktwAerkAYpYASnMAMlDU//+x//+O//9r//9I//8l//8A/v4A3NwAubkAlpYAc3MAUFDU//Cx/+KO/9Rr/8ZI/7gl/6oA/6oA3JIAuXoAlmIAc0oAUDLU/+Ox/8eO/6tr/49I/3Ml/1cA/1UA3EkAuT0AljEAcyUAUBnU/9Sx/7GO/45r/2tI/0gl/yUA/gAA3AAAuQAAlgAAcwAAUADj/9TH/7Gr/46P/2tz/0hX/yVV/wBJ3AA9uQAxlgAlcwAZUADw/9Ti/7HU/47G/2u4/0iq/yWq/wCS3AB6uQBilgBKcwAyUAD//9T//7H//47//2v//0j//yX+/gDc3AC5uQCWlgBzcwBQUADy8vLm5uba2trOzs7CwsK2traqqqqenp6SkpKGhoZ6enpubm5iYmJWVlZKSko+Pj4yMjImJiYaGhoODg7/+/CgoKSAgID/AAAA/wD//wAAAP//AP8A///////g951TAAABAHRSTlP/AP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////rTvmKwAAAFdJREFUGJV1kMENwDAIA/EUTMvsVwhNkKKWFz5hO4opJ9bUhuzoRX4ArdkgYk6+wZUBV+0byD4zZzJwl/mQ1F4WKAMVpkiAdkalZsu8o0GXirYsoPMDtTwsDV5/HlZIZgAAAABJRU5ErkJggg==";
  //勇者後ろ向き2
  yuushaBackImgTwo = new Image();
  yuushaBackImgTwo.src = "data:image/png;base64,iVBORw0K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lP/AP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////rTvmKwAAAFRJREFUGJVtjtENADEIQssUTuvsHGrVpDk+bHixyIHkKaTO+EsewAQszwbuu/IP3gySe0SgHPsR4GawNobQNOJLpmgAZhE6GRdgQ9Sgqsd6H+6maH0YgGMzDPekyQAAAABJRU5ErkJggg==";
  
  //勇者左向き1
  yuushaLeftImgOne = new Image();
  yuushaLeftImgOne.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEUAAACAAAAAgACAgAAAAICAAIAAgIDAwMDA3MCmyvD/8NT/4rH/1I7/xmv/uEj/qiX/qgDckgC5egCWYgBzSgBQMgD/49T/x7H/q47/j2v/c0j/VyX/VQDcSQC5PQCWMQBzJQBQGQD/1NT/sbH/jo7/a2v/SEj/JSX+AADcAAC5AACWAABzAABQAAD/1OP/scf/jqv/a4//SHP/JVf/AFXcAEm5AD2WADFzACVQABn/1PD/seL/jtT/a8b/SLj/Jar/AKrcAJK5AHqWAGJzAEpQADL/1P//sf//jv//a///SP//Jf/+AP7cANy5ALmWAJZzAHNQAFDw1P/isf/Ujv/Ga/+4SP+qJf+qAP+SANx6ALliAJZKAHMyAFDj1P/Hsf+rjv+Pa/9zSP9XJf9VAP9JANw9ALkxAJYlAHMZAFDU1P+xsf+Ojv9ra/9ISP8lJf8AAP4AANwAALkAAJYAAHMAAFDU4/+xx/+Oq/9rj/9Ic/8lV/8AVf8ASdwAPbkAMZYAJXMAGVDU8P+x4v+O1P9rxv9IuP8lqv8Aqv8AktwAerkAYpYASnMAMlDU//+x//+O//9r//9I//8l//8A/v4A3NwAubkAlpYAc3MAUFDU//Cx/+KO/9Rr/8ZI/7gl/6oA/6oA3JIAuXoAlmIAc0oAUDLU/+Ox/8eO/6tr/49I/3Ml/1cA/1UA3EkAuT0AljEAcyUAUBnU/9Sx/7GO/45r/2tI/0gl/yUA/gAA3AAAuQAAlgAAcwAAUADj/9TH/7Gr/46P/2tz/0hX/yVV/wBJ3AA9uQAxlgAlcwAZUADw/9Ti/7HU/47G/2u4/0iq/yWq/wCS3AB6uQBilgBKcwAyUAD//9T//7H//47//2v//0j//yX+/gDc3AC5uQCWlgBzcwBQUADy8vLm5uba2trOzs7CwsK2traqqqqenp6SkpKGhoZ6enpubm5iYmJWVlZKSko+Pj4yMjImJiYaGhoODg7/+/CgoKSAgID/AAAA/wD//wAAAP//AP8A///////g951TAAABAHRSTlP/AP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////rTvmKwAAAGNJREFUGJVtj8EVwCAMQs0UTMvsFKKmPZSLvi+BuEpVxahaK0B8SQAgfUG/DoqDBHmnOgMh+AO3xbE7x/flsyPVsbIDZwsK7g+Adul1OElZbUbyk72WnWkpjtS1npDe/x5HjR5xhmEtRRWNJgAAAABJRU5ErkJggg==";
  //勇者左向き2
  yuushaLeftImgTwo = new Image();
  yuushaLeftImgTwo.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEUAAACAAAAAgACAgAAAAICAAIAAgIDAwMDA3MCmyvD/8NT/4rH/1I7/xmv/uEj/qiX/qgDckgC5egCWYgBzSgBQMgD/49T/x7H/q47/j2v/c0j/VyX/VQDcSQC5PQCWMQBzJQBQGQD/1NT/sbH/jo7/a2v/SEj/JSX+AADcAAC5AACWAABzAABQAAD/1OP/scf/jqv/a4//SHP/JVf/AFXcAEm5AD2WADFzACVQABn/1PD/seL/jtT/a8b/SLj/Jar/AKrcAJK5AHqWAGJzAEpQADL/1P//sf//jv//a///SP//Jf/+AP7cANy5ALmWAJZzAHNQAFDw1P/isf/Ujv/Ga/+4SP+qJf+qAP+SANx6ALliAJZKAHMyAFDj1P/Hsf+rjv+Pa/9zSP9XJf9VAP9JANw9ALkxAJYlAHMZAFDU1P+xsf+Ojv9ra/9ISP8lJf8AAP4AANwAALkAAJYAAHMAAFDU4/+xx/+Oq/9rj/9Ic/8lV/8AVf8ASdwAPbkAMZYAJXMAGVDU8P+x4v+O1P9rxv9IuP8lqv8Aqv8AktwAerkAYpYASnMAMlDU//+x//+O//9r//9I//8l//8A/v4A3NwAubkAlpYAc3MAUFDU//Cx/+KO/9Rr/8ZI/7gl/6oA/6oA3JIAuXoAlmIAc0oAUDLU/+Ox/8eO/6tr/49I/3Ml/1cA/1UA3EkAuT0AljEAcyUAUBnU/9Sx/7GO/45r/2tI/0gl/yUA/gAA3AAAuQAAlgAAcwAAUADj/9TH/7Gr/46P/2tz/0hX/yVV/wBJ3AA9uQAxlgAlcwAZUADw/9Ti/7HU/47G/2u4/0iq/yWq/wCS3AB6uQBilgBKcwAyUAD//9T//7H//47//2v//0j//yX+/gDc3AC5uQCWlgBzcwBQUADy8vLm5uba2trOzs7CwsK2traqqqqenp6SkpKGhoZ6enpubm5iYmJWVlZKSko+Pj4yMjImJiYaGhoODg7/+/CgoKSAgID/AAAA/wD//wAAAP//AP8A///////g951TAAABAHRSTlP/AP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////rTvmKwAAAGFJREFUGJVtj8sVADEIArUKq6V2FjS/w3rIM6MoRjrg6CzDD3FJJLOKfEFXD3IHUMBWGWSZ1B9YEpEpkzRgj9THczlggiUDITFn6e6QnrYmvMC1JeZbcF3Ra1fqlefa9/4Pcg5lNUHFeXgAAAAASUVORK5CYII=";
  
  //勇者右向き1
  yuushaRightImgOne = new Image();
  yuushaRightImgOne.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEUAAACAAAAAgACAgAAAAICAAIAAgIDAwMDA3MCmyvD/8NT/4rH/1I7/xmv/uEj/qiX/qgDckgC5egCWYgBzSgBQMgD/49T/x7H/q47/j2v/c0j/VyX/VQDcSQC5PQCWMQBzJQBQGQD/1NT/sbH/jo7/a2v/SEj/JSX+AADcAAC5AACWAABzAABQAAD/1OP/scf/jqv/a4//SHP/JVf/AFXcAEm5AD2WADFzACVQABn/1PD/seL/jtT/a8b/SLj/Jar/AKrcAJK5AHqWAGJzAEpQADL/1P//sf//jv//a///SP//Jf/+AP7cANy5ALmWAJZzAHNQAFDw1P/isf/Ujv/Ga/+4SP+qJf+qAP+SANx6ALliAJZKAHMyAFDj1P/Hsf+rjv+Pa/9zSP9XJf9VAP9JANw9ALkxAJYlAHMZAFDU1P+xsf+Ojv9ra/9ISP8lJf8AAP4AANwAALkAAJYAAHMAAFDU4/+xx/+Oq/9rj/9Ic/8lV/8AVf8ASdwAPbkAMZYAJXMAGVDU8P+x4v+O1P9rxv9IuP8lqv8Aqv8AktwAerkAYpYASnMAMlDU//+x//+O//9r//9I//8l//8A/v4A3NwAubkAlpYAc3MAUFDU//Cx/+KO/9Rr/8ZI/7gl/6oA/6oA3JIAuXoAlmIAc0oAUDLU/+Ox/8eO/6tr/49I/3Ml/1cA/1UA3EkAuT0AljEAcyUAUBnU/9Sx/7GO/45r/2tI/0gl/yUA/gAA3AAAuQAAlgAAcwAAUADj/9TH/7Gr/46P/2tz/0hX/yVV/wBJ3AA9uQAxlgAlcwAZUADw/9Ti/7HU/47G/2u4/0iq/yWq/wCS3AB6uQBilgBKcwAyUAD//9T//7H//47//2v//0j//yX+/gDc3AC5uQCWlgBzcwBQUADy8vLm5uba2trOzs7CwsK2traqqqqenp6SkpKGhoZ6enpubm5iYmJWVlZKSko+Pj4yMjImJiYaGhoODg7/+/CgoKSAgID/AAAA/wD//wAAAP//AP8A///////g951TAAABAHRSTlP/AP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////rTvmKwAAAGJJRE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lcwAZUADw/9Ti/7HU/47G/2u4/0iq/yWq/wCS3AB6uQBilgBKcwAyUAD//9T//7H//47//2v//0j//yX+/gDc3AC5uQCWlgBzcwBQUADy8vLm5uba2trOzs7CwsK2traqqqqenp6SkpKGhoZ6enpubm5iYmJWVlZKSko+Pj4yMjImJiYaGhoODg7/+/CgoKSAgID/AAAA/wD//wAAAP//AP8A///////g951TAAABAHRSTlP/AP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////rTvmKwAAAGJJREFUGJVVkNERwDAIQnUKp3V2CmjPlvgR36nERFot+RaXNwZgAVC1YNLtIuhVecqCUlReyx+MiUcCApA8lmHwjm06h4rtqaIiSPUyY4JpIeh9mk5kZ58Ss5xsxv277XzEA9VEYfvKjCMoAAAAAElFTkSuQmCC";

}


            
          
!
999px

Console