Hello everyone, I'm doing a project based on backrooms with the aim of having at least 8 levels, but I'm having problems getting the drawn maps collision to work, if anyone has an idea on how to fix it, could you please help me!
I recommend someone with experience download the p8 project and tell me what I should do (and also tell me if there is any bad optimization in the project)
ps:I'm not good at speaking or understanding English, so sorry for the mistake in understanding
I'm a bit of a beginner in Pico 8 programming and I wanted to know how to implement a gravity system that doesn't activate the collision function.
(I saw some tutorials on YouTube and I think I will have to change a large part of my code)
Could anyone tell me how to fix this? (ps: typos due to Google Translate)
player code (related only to movement):
[hidden]
--ben 10 ben = { x = 4*8, y = 9*8, hp= 3, spd= 1, dx=0, dy=0, timer=1, oframe=80, sframe=80, eframe=83, atimer=4, d=false, form=0, head=96, } local benwx=1 local benwy=2 local omini=0 gravity=1 --ben sprite function _draw_ben() spr(ben.head,ben.x,ben.y-8,1,1,ben.d) spr(ben.sframe,ben.x,ben.y,1,1,ben.d) end function benupdate() lx=ben.x ly=ben.y ben.dy=gravity --gravity check?? if mget(nil,ben.y+7/8)~=2 then ben.y+=ben.dy end --walk buttons if (btn(0)) then ben.x-=ben.spd _animate() ben.d=true end if (btn(1)) then ben.x+=ben.spd _animate() ben.d=false end if collide() then ben.x=lx ben.y=ly end --trasform button if (btnp(3)) then omini+=1 ben.form=1 _transform() if ben.head~=96 and omini==2 then _untrans() omini=0 end end end --collision function collide() local benwx=ben.x/8 local benwx2=(ben.x+7)/8 local benwy=ben.y/8 local benwy2=(ben.y+7)/8 if fget(mget(benwx,benwy),1) or fget(mget(benwx2,benwy2),1) then return true else return false end end |