function box(_x,_y,_w,_h) return{ x=_x, y=_y, w=_w, h=_h } end function get_cols(a) local gx,gy=flr(a.x/8),flr(a.y/8) local ex,ey=flr((a.x+a.w-1)/8),flr((a.y+a.h-1)/8) local list={} for i=gx-1,ex+1 do for ii=gy-1,ey+1 do if fget(mget(i,ii),0) then add(list,box(i*8,ii*8,8,8)) end end end return list end function collide(a,_dx,_dy,list,side) local ca={ x=flr(a.x), y=flr(a.y), w=a.w, h=a.h } for i=1,#list do local v=list[i] if col(v,ca) then if _dx>0 then a.x=v.x-a.w side["right"]=true elseif _dx<0 then a.x=v.x+v.w side["left"]=true end if _dy>0 then a.y=v.y-a.h side["down"]=true elseif _dy<0 then a.y=v.y+v.h side["up"]=true end end end end --diss code expects that "a" have a --dx and dy function move(a) local sides={ ["left"]=false, ["right"]=false, ["up"]=false, ["down"]=false } local l=get_cols(a) a.x+=a.dx collide(a,a.dx,0,l,sides) a.y+=a.dy collide(a,0,a.dy,l,sides) if sides["up"] or sides["down"] then a.dy=0 end if sides["left"] or sides["right"] then a.dx=0 end return sides end function col(a,b) return not( (a.x>b.x+b.w-1)or (b.x>a.x+a.w-1)or (a.y>b.y+b.h-1)or (b.y>a.y+a.h-1) ) end |
this is the code that i use for collisions with the map
is not perfect but it works
hehe
the code is based in the pygame way of doing collisions
probably not the best way of doing collisions in pico-8
but it works for me atleast
the way to use this, is to just call the move function
in a table that have dx and dy
dx="direction in the x-axis"
dy="direction in the y-axis"
and update dx and dy
i not a pico-8 expert so, i probably using a lot of tokens
star_addicted
star addicted is fast passed 2d platformer
you collect star to calm you down, you have a dash abilitty to go faster.
you can also get a keys over time to travel faster using doors
have fun.
its my birthday yay.
3d_thing
i been kinda busy , but still trying some game_dev_stuff, diss is a spining cube , using real 3d , i think is neat ,
i been also making a game in godot , a fun engine , more updates in that later.
enjoy the funny 3d shape
third_person_camera
i want to make a 3d game in pico8, but i without time to spend in gamedev ,with the time i have left i doing some camera work , diss a tps style camera(i have to charge some variables to accommodate to the pico8 128x128 screen) , i hope you all can find a good use to it , i also want to thanks the help i got from freds72 (the guy who ported doom to pico8), and again i using sokpop sorce code as reference.
This is something a code a long time ago, is a basic 3d menu , the only time i saw a menu like diss was in sonic adveture, and i think a sony console had some menu like diss , but i not so sure , well i hope some one can find good use of diss.
mouse_in_world_space
How do you get the mouse x and y based on world space ?
i saw that pico8 got a free version so i decide to make a small game
i kinda new in to developing games ,and that why the game is so simple , or maybe is because pico8 token count said he hates me,
who knows.
about the game he is kinda_like a rougue like , he very inspired in the binding of issac, but simpler
every door do something
yellow
is the item room
pink one
is a mystery can have enemies or good_stuff
the brown one
is just a enemy room
the controls are the keybord keys and z and x
z are shot
x use card
diss game is not that good , is very short and you can see that, is more like train to flex my programing skils that anything .
btw the code is pretty bad , have fun :)