我以这种方式创建图像:
var orc = new Image();
orc.src = "./orc.png";
我在这样的对象中使用图像:
function Character(hp, image){
this.hp = hp;
this.image = image;
};
我多次调用它,例如:
unit245 = new Character(100, orc);
我以这种方式绘制它,例如:
ctx.drawImage(unit245.image, 15, 55, 100, 100);
如何在画布上单击鼠标或在 unit245 上方移动?
我需要这样的东西http://easeljs.com/examples/dragAndDrop.html但没有任何框架(jquery除外)