It looks like you're new here. If you want to get involved, click one of these buttons!
local x=3 local rec_smallBnt = Button.new(Bitmap.new(Texture.new("images/rec_smallBnt.png")), Bitmap.new(Texture.new("images/rec_smallBnt.png"))) rec_smallBnt:setPosition((application:getContentWidth()- 90), (application:getContentHeight() * 0.5 + 105)) self:addChild(rec_smallBnt) rec_smallBnt:addEventListener("click", function() x = x - 1 if x == 2 then local rec_small = Bitmap.new(Texture.new("images/rec_small.png")) --setting the x and y coordinates randomly rec_small:setX(math.random(0, 320 - 100)) rec_small:setY(math.random(0, 480 - 50)) rec_small.isFocus = false --add the event listeners for the two functions rec_small:addEventListener(Event.MOUSE_DOWN, onMouseDown, rec_small) rec_small:addEventListener(Event.MOUSE_MOVE, onMouseMove, rec_small) rec_small:addEventListener(Event.MOUSE_UP, onMouseUp, rec_small) --adding the shape to the stage self:addChild(rec_small) elseif x == 1 then local rec_small = Bitmap.new(Texture.new("images/rec_small.png")) --setting the x and y coordinates randomly rec_small:setX(math.random(0, 320 - 100)) rec_small:setY(math.random(0, 480 - 50)) rec_small.isFocus = false --add the event listeners for the two functions rec_small:addEventListener(Event.MOUSE_DOWN, onMouseDown, rec_small) rec_small:addEventListener(Event.MOUSE_MOVE, onMouseMove, rec_small) rec_small:addEventListener(Event.MOUSE_UP, onMouseUp, rec_small) --adding the shape to the stage self:addChild(rec_small) end end ) |
Comments
Here's a little code I've tried:
Likes: QuasarCreator