hello corona comunity :)
i am trying to make a system used by feed me oil, that is it, i have the icon on the screen and when i touch or press the icon to drag it will appear the object that i select and can drag to the game area, and when i drag the object up to icon the object disappear to the icon, it is like feed me oil objects system
someone has done something similar? or know any place where I can go see it to learn?
Thank you very much
I'm not sure if I've understood you perfectly or not, but I wrote this code that I think will help you. Try it out in a new project just to see how it goes :)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| require ( "physics" )
physics.start()
physics.setGravity( 0, 0 )
local pipe = display.newRect( 150, 0, 20, 80 )
physics.addBody(pipe, "static", {isSensor = true})
pipe:addEventListener("collision", pipe)
function pipe:collision (event)
event.other:removeSelf()
end
local spawner = display.newRect( 140, 400, 40, 40 )
spawner:setFillColor(150, 0, 0)
local function spawnMyObject (event)
if event.phase == "began" then
local myObject = display.newCircle( spawner.x, spawner.y, 25 )
physics.addBody(myObject, "dynamic")
local function dragObject (event)
myObject.x = event.x
myObject.y = event.y
end
myObject:addEventListener("touch", dragObject)
end
end
spawner:addEventListener("touch", spawnMyObject) |
Thank you very much Peach :) is really this that i need. i am very grateful, corona is great