can you guys help me with this bug why mytext isnt diplaying i wrote everything correctly can you guys help me please
here is the code
display.setStatusBar( display.HiddenStatusBar )
– Start Physics
local physics = require(“physics”)
physics.start()
– Set Variables
_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; – Variable used to move character along y axis
speed = 2; – Set Walking Speed
jump = 3;-- set jumping speed
score=0;
local myText = display.newText(score,_W-20,_H-20, native.systemFont, 30 )
– Add Sky to the background
local sky = display.newImage(“background_sky.png”)
sky.x = _W/2; sky.y = 160;
– add platform1 to game
local platform1 = display.newImage( “grass.png”)
platform1.width=100;platform1.height=20;platform1.x=150;platform1.y=_H/2;
physics.addBody(platform1,“static”,{ friction=0.5, bounce=0.3 })
– add platform2 to game
local platform2 = display.newImage( “grass.png”)
platform2.width=100;platform2.height=20;platform2.x=350;platform2.y=_H/2-70;
physics.addBody(platform2,“static”,{ friction=0.5, bounce=0.3 })
– Add Grass floor to game
local grass_bottom = display.newImage( “grass_bottom.png”)
grass_bottom.x = _W/2; grass_bottom.y = _H-35;
–grass_bottom:setReferencePoint(display.BottomLeftReferencePoint)
physics.addBody( grass_bottom, “static”, { friction=0.5, bounce=0.3 } )
– Add Grass to the background
local grass_top = display.newImage( “grass_top.png”)
grass_top.x = _W/2; grass_top.y = _H-95;
– Add Guy
local guy = display.newImage( “guy.png” )
physics.addBody( guy, “dynamic”, { friction=0.5, bounce=0 } )
guy.x = 2; guy.y = 150;
– Add left joystick button
local left = display.newImage (“btn_arrow.png”)
left.x = 45; left.y = 280;
left.rotation = 180;
– Add right joystick button
local right = display.newImage (“btn_arrow.png”)
right.x = 120; right.y = 282;
– add up joystick button
local up = display.newImage (“btn_arrow.png”)
up.x = 195;up.y=280;
up.rotation=-90;
– Stop character movement when no arrow is pushed
local function stop (event)
if event.phase ==“ended” then
motionx = 0;
motiony = 0;
end
end
Runtime:addEventListener(“touch”, stop )
– Move character
local function moveguy (event)
if guy.x < _W - 2 then
if guy.x > 2 then
guy.x = guy.x + motionx;
guy.y = guy.y - motiony;
end
if guy.x == 2 then
guy.x=3;
end
if guy.x < 2 then
guy.x=3;
end
if guy.x < _W - 2 then
guy.x = guy.x + motionx;
guy.y = guy.y - motiony;
end
if guy.x == _W - 2 then
guy.x=_W-3;
end
if guy.x > _W - 2 then
guy.x=_W-3;
end
end
end
Runtime:addEventListener(“enterFrame”, moveguy)
– When left arrow is touched, move character left
function left:touch()
motionx = -speed;
end
left:addEventListener(“touch”,left)
– When right arrow is touched, move character right
function right:touch()
motionx = speed;
end
right:addEventListener(“touch”,right)
– When up arrow is touched, move character up
function up:touch()
motiony = jump;
end
up:addEventListener(“touch”,up)