ButtonTest ={};
ButtonTest.new = function()
this = {};
this.pos = {};
this.pos.x = display.contentWidth/2;
this.pos.y = display.contentHeight/2;
this.offset = {};
this.offset.x = nil;
this.offset.y = nil;
this.Image = {};
this.Image.a = {};
this.Image.a.File = "画像のアドレス.拡張子";
this.Image.a.Show = nil;
print(this.Image.a.File);
this.Image.b = {};
this.Image.b.File = "画像のアドレス.拡張子";
this.Image.b.Show = nil;
this.Set = function()
this.Image.a.Show = display.newImage(this.Image.a.File);
this.Image.a.Show.x = this.pos.x;
this.Image.a.Show.y = this.pos.y;
end;
this.Run = function( event )
if "began" == event.phase then
this.Image.b.Show = display.newImage(this.Image.b.File);
this.Image.b.Show.x = this.pos.x;
this.Image.b.Show.y = this.pos.y;
print("testpos");
print(this.Image.b.Show.x);
this.Shape = Triangle;
--print(this.Image.b.Show.y);
--this.Image.b.Show.x = this.pos.x;
--this.Image.b.Show.y = this.pos.y;
end;
if "moved" == event.phase then
if (event.x <= event.target.x + event.target.width/2-5 and event.x >= event.target.x - event.target.width/2+5
and event.y <= event.target.y + event.target.height/2-5 and event.y >= event.target.y - event.target.height/2+5 )then
-- In Box
else
if(this.Image.b.Show ~= nil) then
this.Image.b.Show:removeSelf();
this.Image.b.Show = nil;
end;
end;
end;
if "ended" == event.phase or "cancelled" == event.phase then
if(this.Image.b.Show ~= nil) then
this.Image.b.Show:removeSelf();
this.Image.b.Show = nil;
end;
--this.Image.a.Show:removeEventListener("touch",this.Run);
end;
print("Success!!")
--this.Image.a:addEventListener("touch",this.Run);
return true;
end;
this.Test = function()
this.Image.a.Show = display.newImage(this.Image.a.File);
this.Image.a.Show.x = this.pos.x;
this.Image.a.Show.y = this.pos.y;
this.Image.b.Show = display.newImage(this.Image.b.File);
this.Image.b.Show.x = this.pos.x/2;
this.Image.b.Show.y = this.pos.y/2;
end;
return this;
end;