hi
hi guys what up can anybody give me some codes to try out just started
yess let go hope you find some codes this is one of mine =) for people who just started or want to have the code of =)
init = function() end
update = function() position = position+2 end
draw = function() screen.fillRect(0,0,screen.width,screen.height,"rgb(57,0,57)")
for i=-6 to 6 by 1 screen.drawSprite("wall",i*40-position%40,-80,40) end
screen.drawSprite("hero",-80,-50,20) end
sry guys this was the wrong code like it doesn't work
position = position+2
is much easier to just position += 2
.
And you should declare position in the Init func. This is the right code:
init = function()
position = 0
end
update = function()
position += 2
end
draw = function()
screen.clear("rgb(57,0,57")
for i=0 to 12 by 1 //You don't need actually the by 1
screen.drawSprite("wall", i*40-position%40, -80, 40)
end
screen.drawSprite("hero", -80, -50, 20)
end