Log In  
Follow
Davi_dash

I make mistakes and call them video games.

[ :: Read More :: ]
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

P#141827 2024-02-23 18:27 ( Edited 2024-03-03 15:55)

[ :: Read More :: ]

Cart #star_addicted_full-0 | 2023-11-25 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

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.

P#137894 2023-11-25 21:58

[ :: Read More :: ]

Cart #raymaster-0 | 2023-11-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Casting a ray

a basic line_cast algorithm

P#137790 2023-11-22 21:11

[ :: Read More :: ]

Cart #hohpojido-0 | 2023-09-03 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7


i dont know i just like to do some cool Visual carts, i guess... enjoy

P#133898 2023-09-03 20:53 ( Edited 2023-09-03 20:55)

[ :: Read More :: ]

Cart #birthdayyay-0 | 2023-08-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4


its my birthday yay.

P#133486 2023-08-24 22:28

[ :: Read More :: ]

Cart #sifepubaru-0 | 2023-07-09 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

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

P#131774 2023-07-09 16:14 ( Edited 2023-07-09 16:14)

[ :: Read More :: ]

Cart #cdcoolthing-0 | 2022-11-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

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.

P#121432 2022-11-26 20:21

[ :: Read More :: ]

Cart #risodisosi-0 | 2022-10-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

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.

P#118278 2022-10-01 13:03 ( Edited 2022-11-13 03:34)

[ :: Read More :: ]

mouse_in_world_space

How do you get the mouse x and y based on world space ?

P#114570 2022-07-20 12:41

[ :: Read More :: ]

Cart #jariputuda-0 | 2022-07-12 | Code ▽ | Embed ▽ | No License
15

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 :)

P#114234 2022-07-12 14:29 ( Edited 2023-08-21 12:50)