I made this its not very clean but I’m just getting back in to the swing of things, I really like using the codea software and v1.5 is a really good upgrade to the previous version but there’s a problem with the physics, if you run the following script then eventually the box will just fall through the floor which is a problem, or it will go through a wall, any input is good, thanks
-- platformer -- Use this function to perform your initial setup function setup() print("Hello World!") displayMode(FULLSCREEN) scr=vec2() scr.x=WIDTH/2 scr.y=HEIGHT/2 box=physics.body(POLYGON,vec2(-30,30),vec2(-30,-30),vec2(30,-30),vec2(30,30)) box.x=scr.x-500 box.y=scr.y-200 box.mass=5 box.friction = 1 box.restitution = 0.4 box.interpolate = true box.sleepingAllowed = false pos={} n=9 mspeed=0 touching=0 stepx=0 stepy=0 stickv=vec2() spos=vec2() for i=0,1000 do if n >= 10 then stepy=stepy+math.random(1,6) stepx=-100 n=0 else stepx=0 n=n+1 end pos[i]=vec2(i*100-400+stepx,stepy*15-200) end physics.body(CHAIN,false,unpack(pos)) n=0 end function collide(c) if c.state == BEGAN or c.state == MOVING then touching=1 elseif c.state == ENDED then touching=0 end end function xjoyStick(pos) local ct=CurrentTouch --local spos = vec2() rect(pos.x,pos.y-10,190,20) spos.x = ct.x-pos.x-scr.x stickv.y = pos.y if ct.state == MOVING or ct.state == BEGAN and vec2(ct.x,ct.y):dist(pos)<200 then stickv.x = pos.x+spos.x elseif ct.state == ENDED then stickv.x = pos.x+97.5 end stickv.x = math.max(stickv.x,pos.x) stickv.x = math.min(stickv.x,pos.x+195) ellipse(stickv.x,stickv.y,50) mspeed=-(pos.x-stickv.x+97.5) end -- This function gets called once every frame function draw() -- Screen scrolling from box position if box.x>WIDTH-200-scr.x then scr.x=WIDTH-200-box.x elseif box.xHEIGHT-100-scr.y then scr.y=HEIGHT-100-box.y elseif box.ypos[n+39].x then n=n+1 end line(pos[i-1].x,pos[i-1].y,pos[i].x,pos[i].y) end end ```