# "lua platformer script" Code Answer's

You're definitely familiar with the best coding language Lua that developers use to develop their projects and they get all their queries like "lua platformer script" answered properly. Developers are finding an appropriate answer about lua platformer script related to the Lua coding language. By visiting this online portal developers get answers concerning Lua codes question like lua platformer script. Enter your desired code related query in the search bar and get every piece of information about Lua code related question on lua platformer script.

### lua platformer script

By Trublub on Feb 13, 2021
``````function solid(x,y)
return solids[mget((x)//8,(y)//8)]
end

function init()
solids={[1]=true,[3]=true}
p={
x=120,
y=68,
vx=0, --Velocity X
vy=0, --Velocity Y
}
end

init()
function TIC()

if btn(2) then p.vx=-1
elseif btn(3) then p.vx=1
else p.vx=0
end

if solid(p.x+p.vx,p.y+p.vy) or solid(p.x+7+p.vx,p.y+p.vy) or solid(p.x+p.vx,p.y+7+p.vy) or solid(p.x+7+p.vx,p.y+7+p.vy) then
p.vx=0
end

if solid(p.x,p.y+8+p.vy) or solid(p.x+7,p.y+8+p.vy) then
p.vy=0
else
p.vy=p.vy+0.2
end

if p.vy==0 and btnp(4) then p.vy=-2.5 end

if p.vy<0 and (solid(p.x+p.vx,p.y+p.vy) or solid(p.x+7+p.vx,p.y+p.vy)) then
p.vy=0
end

p.x=p.x+p.vx
p.y=p.y+p.vy

cls()
map()
rect(p.x,p.y,8,8,15)
end``````