Doodle your own platformer level and test it with your own characters!

Made in 999 compressed bytes

Controls

  • Mouse - Draw
  • X - Next mode (while drawing)
  • Z - Jump (while playing)
Source code

poke(0x5f2d,1)
cnv_a={}
cnv_b={}
cnv_c={}
col=0
function _draw()
	lx,ly,mx,my,mb=mx,my,stat(32),stat(33),stat(34)~=0
	cls(7)camera()
	
	-- draw level
	canvas(cnv_b,1,1)
	canvas(cnv_a,1,1)
	
	-- playtest
	if play then
		ground=solid(px,py+1)
		dy+=0.4
		psx=lerp(psx,1,0.2)
		psy=lerp(psy,1,0.2)
		
		-- walking
		if btn(0) or btn(1) then
			if(btn(0))dx,flipx=max(dx-0.3,-2),1
			if(btn(1))dx,flipx=min(dx+0.3,2)
		else
			if ground then
				dx*=0.6
			end
		end
		
		-- jump
		if(ground and btn(4)) psx,psy,dy=.5,1.5,-5
		
		-- animation
		if(not wg and ground)psx,psy=1.25,.75
		wg=ground
		if(btn(3))psx,psy=lerp(psx,1.5,.3),lerp(psy,.5,.3)
		
		-- upsplope
		while solid(px+dx,py)
		and not solid(px+dx,py-2) do
			py-=1
		end
		
		-- horizontal
		if(solid(px+dx,py))dx=0
		px+=dx
		
		-- downslope
		if ground and
		not solid(px,py+1)
		and solid(px,py+4) do
			while not solid(px,py+1) do
				py+=1
			end
		end
		
		-- vertical
		if not solid(px,py)
		and solid(px,py+dy) do
			while not solid(px,py+sgn(dy)) do
				py+=sgn(dy)
			end
			dy=0
		end
		py+=dy
		
		-- draw player
		camera(-px,-py)
		canvas(cnv_c,psx,psy,flipx)
		
	-- draw elements
	else
		-- draw bg
		if state==1 then
			if(mb)add(cnv_b,{lx,ly,mx,my,6})
			if(btnp(4) or btnp(5))state=2
			?"❎draw background",32,1,12
		-- draw player
		elseif state==2 then
			if(mb)add(cnv_c,{lx,ly,mx,my,0})
			canvas(cnv_c,1,1)
			if(btnp(4) or btnp(5))begin()
			?"❎draw player",38,1,12
		-- draw level
		else
			if(mb)add(cnv_a,{lx,ly,mx,my,0})
			if(btnp(4) or btnp(5))state=1
			?"❎draw level",40,1,12
		end
		line(mx,my,mx+3,my+3,0)
	end
end
-- utils
function begin()
dx,dy,psx,psy=0,0,1,1
px1,py1,px2,py2=256,256,0,0
for l in all(cnv_c) do
	px1=min(px1,min(l[1],l[3]))
	py1=min(py1,min(l[2],l[4]))
	px2=max(px2,max(l[1],l[3]))
	py2=max(py2,max(l[2],l[4]))
end
pw,ph=px2-px1,py2-py1
px,py=px1+pw/2,py1+ph
for l in all(cnv_c) do
	l[1]-=px1+pw/2
	l[3]-=px1+pw/2
	l[2]-=py1+ph
	l[4]-=py1+ph
end
play=1
end
function solid(px,py)
for x=-pw/4,pw/4 do
for y=-max(ph*.8,4),0 do
if(pget(px+x,py+y)==0)return 1
end end end
function canvas(t,sx,sy,f)
if(f)sx*=-1
for l in all(t) do
line(l[1]*sx,l[2]*sy,l[3]*sx,l[4]*sy,l[5])
end
end
function lerp(a,b,d)
return a+(b-a)*d
end

Published 10 hours ago
StatusPrototype
PlatformsHTML5
Rating
Rated 5.0 out of 5 stars
(2 total ratings)
AuthorWuffMakesGames
GenrePlatformer
Made withPICO-8
TagsDrawing, gamedev, PICO-8, Prototype

Comments

Log in with itch.io to leave a comment.

Cute and fun

very squishy

love it!