Inferior / superior

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

if armadillo.x < 35 then armadillo.x = 35 end

< and > are conditional tests. < means “less than” and > means greater than.  You cannot use them for assignments.

someVariable \< someValue 

doesn’t make sense. Assignments are done with a single equal sign ( = )

someVariable = someValue

To use < and > you need to use them at times that conditional tests are needed such as in an “if”, “while” or “repeat” statement

local count = 1 while count \< 10 do &nbsp;&nbsp;&nbsp;&nbsp; print( count ) &nbsp;&nbsp;&nbsp;&nbsp; count = count + 1 end if armadillo.x \< 35 then &nbsp;&nbsp;&nbsp;&nbsp; print( "Armadillo to close to the edge") end

Note I also took the quotes off of 35. 35 is a number and numbers don’t use quotes. You put quotes around strings. Now “35” is a valid string, but it’s not a valid number and while you can technically use things like <, > and == with strings, it’s not the same as doing math with them.

Rob

Please, help me for my other problem here : https://forums.coronalabs.com/topic/62743-game-if-time-then-new-object-problem/?p=325622

Thak you !

if armadillo.x < 35 then armadillo.x = 35 end

< and > are conditional tests. < means “less than” and > means greater than.  You cannot use them for assignments.

someVariable \< someValue 

doesn’t make sense. Assignments are done with a single equal sign ( = )

someVariable = someValue

To use < and > you need to use them at times that conditional tests are needed such as in an “if”, “while” or “repeat” statement

local count = 1 while count \< 10 do &nbsp;&nbsp;&nbsp;&nbsp; print( count ) &nbsp;&nbsp;&nbsp;&nbsp; count = count + 1 end if armadillo.x \< 35 then &nbsp;&nbsp;&nbsp;&nbsp; print( "Armadillo to close to the edge") end

Note I also took the quotes off of 35. 35 is a number and numbers don’t use quotes. You put quotes around strings. Now “35” is a valid string, but it’s not a valid number and while you can technically use things like <, > and == with strings, it’s not the same as doing math with them.

Rob

Please, help me for my other problem here : https://forums.coronalabs.com/topic/62743-game-if-time-then-new-object-problem/?p=325622

Thak you !