i do not know what is wrong here im at my whits end. it has taken me a long time to get all this together and i just cannot make it work. please help. modify it and reply it suggest problems. anything laugh at me for doing this in a crap way.
i wanna use the loop to get each item name out of a table, then u want to use transition.to to send the main actor to the item, then continue on to the next one. HELP PLES!!!
much appreciated.
HERE IS THE CODE
local physics = require("physics")
physics.start()
physics.setGravity( 0, 0)
physics.setDrawMode( "hybrid" )
local background = display.newRect(0,0,320,480)
background:setFillColor(255,50,0)
local Yaxis = display.newLine(160,0,160,480)
local Xaxis = display.newLine(0,240,320,240)
-- 4 nodes 1 in each corner type thing
--node Top Left
local tlNode = display.newRect(60,100,20,20)
--node top right
local trNode = display.newRect(240,100,20,20)
--node bottom Left
local blNode = display.newRect(60,400,20,20)
--node bottom right
local brNode = display.newRect(240,400,20,20)
-- new nodes to be used in my dynamic follow the points function
local Node1 = display.newRect(60,350,20,20)
local Node2 = display.newRect(110,400,20,20)
-- create the Seeker
local seeker = display.newImage("arrow.png")
physics.addBody( seeker, "static")
seeker.isSensor = true
local seekertail = display.newCircle(60, 20, 10)
physics.addBody( seekertail, "dynamic")
seekertail.isSensor = true
local tail = physics.newJoint( "pivot", seekertail, seeker, seeker.x, seeker.y)
local loop = 1
local called = 1
local name
local travels = {}
table.insert(travels, "tlNode")
table.insert(travels, "trNode")
table.insert(travels, "brNode")
table.insert(travels, "blNode")
local function driveThePoints()
while loop \<= #travels do
if loop == #travels then
name = travels[called]
local mover = function()
print("mover number "..called.." called, MOVE TO "..name)
nxtnum = called + 1
name = travels[nxtnum]
called = called + 1
end
timer.performWithDelay(loop \* 2000 - 2000, mover, 1)
print("transition.to( seeker, {delay="..loop \* 2000 - 2000 ..",time= 2000, x="..travels[loop]..".x, y="..travels[loop]..".y, onComplete=driveThePoints})")
print("will now start again")
else
name = travels[called]
mover = function()
print("mover number "..called.." called, MOVE TO "..name)
print("transition.to( seeker, {time= 2000, x="..travels[called]..".x, y="..travels[called]..".y})")
transition.to( seeker, {time= 1000, x=travels[called].x, y=travels[called].y})
nxtnum = called + 1
name = travels[nxtnum]
called = called + 1
end
timer.performWithDelay(loop \* 2000 - 2000, mover, 1)
print("will travel to : "..travels[loop])
print("transition.to( seeker, {delay="..loop \* 2000 - 2000 ..",time= 1000, x="..travels[loop]..".x, y="..travels[loop]..".y})")
print("then travels to ...")
end
loop = loop + 1
end
end
driveThePoints()
[import]uid: 66719 topic_id: 15189 reply_id: 315189[/import]
[import]uid: 52491 topic_id: 15189 reply_id: 56259[/import]