Miracle5,
function rykaOnMouseMove(e) {
if (selectedBlock) {
selectedBlock.x = e.pageX+xx;
selectedBlock.y = e.pageY+yy;
DrawGame();
}
}
var xx = yy = 0;
function GetImageBlock(list, x, y) {
//for (var i = 0; i < list.length; i++) {
for (var i = list.length - 1; i >= 0; i--) {
var imgBlock = list[i];
var x1 = imgBlock.x;
var x2 = x1 + BLOCK_WIDTH;
var y1 = imgBlock.y;
var y2 = y1 + BLOCK_HEIGHT;
if (
(x >= x1 && x <= x2) &&
(y >= y1 && y <= y2)
) {
//alert("found: " + imgBlock.no);
xx = imgBlock.x - x;
yy = imgBlock.y - y
var img = new imageBlock(imgBlock.no, imgBlock.x, imgBlock.y);
//drawImageBlock(img);
return img;
}
}
return null;
}