Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Balls Example
115 bytes added
,
13:29, 17 June 2012
no edit summary
Line 36:
Line 36:
function on.mouseUp(x,y)
function on.mouseUp(x,y)
+
cursor.set("default")
isGrabbing = false
isGrabbing = false
platform.window:invalidate()
platform.window:invalidate()
Line 47:
Line 48:
function on.mouseMove(x,y)
function on.mouseMove(x,y)
if isGrabbing and (trackedBall and trackedBall.isActive) then
if isGrabbing and (trackedBall and trackedBall.isActive) then
−
txt2 = "moving ball #"..trackedBall.id
+
cursor.set("drag grab")
−
trackedBall:move(x-trackedBall.r/2,y-trackedBall.r/2)
+
txt2 = "moving ball #"..trackedBall.id
+
trackedBall:move(x-trackedBall.r/2,y-trackedBall.r/2)
else
else
−
txt2 = "not moving anything"
+
txt2 = "not moving anything"
−
for i,ball in ipairs(ballsTable) do
+
for i,ball in ipairs(ballsTable) do
−
if math.abs(ball.x+ball.r/2-x) <= ball.r/1.8 and math.abs(ball.y+ball.r/2-y) <= ball.r/1.8 then
+
if math.abs(ball.x+ball.r/2-x) <= ball.r/1.8 and math.abs(ball.y+ball.r/2-y) <= ball.r/1.8 then
−
ball.isActive = true
+
ball.isActive = true
−
trackedBall = ball
+
trackedBall = ball
−
else
+
else
−
ball.isActive = false
+
ball.isActive = false
+
end
+
end
end
end
−
end
−
end
end
end
Adriweb
Bureaucrats
,
Administrators
935
edits
Navigation menu
Personal tools
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version