﻿/***************************
	Onload Function
****************************/
onload = function() {
  player1();
  ground01fw();
  ground01mf();
  ground01df();
};


/***************************
	Canvas Part
****************************/
var fwH = 79;
var mfH = 114;
var dfH = 104;
var grndW = 250;

function ground01fw() {
  var canvas = document.getElementById('ground01-fw');
  if ( ! canvas || ! canvas.getContext ) { return false; }
  var ctx = canvas.getContext('2d');
  ctx.beginPath();
  var grad  = ctx.createLinearGradient(0,0, 0,fwH);
  grad.addColorStop(0,'#00ee00');
  grad.addColorStop(1,'#00aa00');
  ctx.fillStyle = grad;
  ctx.rect(0,0, grndW,fwH);
  ctx.fill();
  ctx.beginPath();
  ctx.moveTo(50, 0);
  ctx.lineTo(50, 60);
  ctx.lineTo(200, 60);
  ctx.lineTo(200, 0);
  ctx.moveTo(90, 0);
  ctx.lineTo(90, 30);
  ctx.lineTo(160, 30);
  ctx.lineTo(160, 0);
  ctx.stroke();
  ctx.beginPath();
  ctx.arc(grndW/2, 45, 30, 150 * Math.PI / 180, 30 * Math.PI / 180, true);
  ctx.stroke();
}

function ground01mf() {
  var canvas = document.getElementById('ground01-mf');
  if ( ! canvas || ! canvas.getContext ) { return false; }
  var ctx = canvas.getContext('2d');
  ctx.beginPath();
  var grad  = ctx.createLinearGradient(0,0, 0,mfH);
  grad.addColorStop(0,'#eeee00');
  grad.addColorStop(1,'#aaaa00');
  ctx.fillStyle = grad;
  ctx.rect(0,0, grndW,mfH);
  ctx.fill();
  ctx.beginPath();
  ctx.moveTo(0, 70);
  ctx.lineTo(grndW, 70);
  ctx.stroke();
  ctx.beginPath();
  ctx.arc(125, 70, 30, 0, Math.PI*2, false);
  ctx.stroke();
}

function ground01df() {
  var canvas = document.getElementById('ground01-df');
  if ( ! canvas || ! canvas.getContext ) { return false; }
  var ctx = canvas.getContext('2d');
  ctx.beginPath();
  var grad  = ctx.createLinearGradient(0,0, 0,dfH);
  grad.addColorStop(0,'#00eeee');
  grad.addColorStop(1,'#00aaaa');
  ctx.fillStyle = grad;
  ctx.rect(0,0, grndW,dfH);
  ctx.fill();
  ctx.beginPath();
  ctx.moveTo(50, dfH);
  ctx.lineTo(50, 44);
  ctx.lineTo(200, 44);
  ctx.lineTo(200, dfH);
  ctx.moveTo(90, dfH);
  ctx.lineTo(90, 74);
  ctx.lineTo(160, 74);
  ctx.lineTo(160, dfH);
  ctx.stroke();
  ctx.beginPath();
  ctx.arc(grndW/2, 59, 30, 330 * Math.PI / 180, 210 * Math.PI / 180, true);
  ctx.stroke();
}

function player1() {
	for(i=1;i<12;i++){
	  var canvas = document.getElementById('mem'+i);
	  if ( ! canvas || ! canvas.getContext ) { return false; }
	  var ctx = canvas.getContext('2d');
	  ctx.beginPath();
	  ctx.fillStyle = 'rgb(128, 128, 128)';
	  ctx.arc(40, 18, 14, 0, Math.PI*2, false);
	  ctx.fill();
	  ctx.beginPath();
	  ctx.fillStyle = '#ff0000'; // 赤
	  ctx.arc(37, 15, 14, 0, Math.PI*2, false);
	  ctx.fill();
	  ctx.beginPath();
	  ctx.arc(37, 15, 14, 0, Math.PI*2, false);
	  ctx.stroke();
	}
}
