我以這種方式創建圖像:我可以在畫布上打印圖像嗎?
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);
如何讓鼠標點擊或移動到畫布上的單位245以上?
我需要的是這樣的http://easeljs.com/examples/dragAndDrop.html但沒有任何框架(除了jQuery的)
鼠標座標已經回答了:http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas –