Hi,
I have a little problem, i don’t know how tu use “<” “>” these sings in my lua project …
This is what I wrote, can you help me please ?
function scene:create(event) --Background local background = display.newImage("fond.png", 200, 250, 480, 70) --Player local armadillo = display.newImage ("arm.png", 160, 200, 30) --physics.addBody(armadillo, "dynamic",{ bounce =0.8,friction = 1.0}) --www.thatssopanda.com/corona-sdk-tutorials/moving-a-character-left-and-right-with-corona-sdk/ \_W = display.contentWidth; -- Get the width of the screen \_H = display.contentHeight; -- Get the height of the screen motionx = 0; -- Variable used to move character along x axis motiony = 0 speed = 3; -- Set Walking Speed --create button local gauche = display.newImage("boutongauche.png") gauche.x = 50; gauche.y = 460; local droit = display.newImage("boutondroit.png") droit.x = 150; droit.y = 460 local bas = display.newImage("boutonbas.png") bas.x = 100; bas.y = 460 local haut = display.newImage("boutonhaut.png") haut.x = 100; haut.y = 410 --move character function gauche:touch() motionx = -speed; end gauche:addEventListener("touch",gauche) function droit:touch() motionx = speed; end droit:addEventListener("touch",droit) function haut:touch() motiony = -speed; end haut:addEventListener("touch", haut) function bas:touch() motiony = speed; end bas:addEventListener("touch", bas) local function movearmadillo (event) armadillo.x = armadillo.x + motionx; armadillo.y = armadillo.y + motiony end Runtime:addEventListener("enterFrame", movearmadillo) local function stop (event) if event.phase =="ended" then motionx = 0; motiony = 0 end if event.phase == "ended" then armadillo.x \< "35" end end Runtime:addEventListener("touch", stop ) --function moveArmadillo (event) --local armadillo = event.target --armadillo:applyLinearImpulse( 0.01, -0.2, event.x, event.y) --end --armadillo:addEventListener("touch", moveArmadillo) end
Line 65 to 74 I want to say : if the armadillo goes too has left, it’s stopped (to not out of the screen)
and the same for right, up and down.
Thank you,
Lucas