Log In  
Follow
collinthenewmaker
:: Unfold ::

so today i made this
use it as you want guys
also maybe it's not token-efficient but
i'll leave it up to you

function randprob_from(l)
    --the function expects an
    --array of tables like these:
    --{p=0.5,v='item name'}

    --a "p" value between 0 and 1
    --and a "v" value.

    --"p" is propability of the
    --"v" value being returned

    local lim=1
    local value=rnd()
    for pos in all(l) do
        highlimit=lim
        lim-=pos.p
        lowlimit=lim
        if value<highlimit
        and value>=lowlimit then
            return pos.v
        end
    end
end

Cart #pipugozape-1 | 2023-05-27 | Code ▽ | Embed ▽ | No License

P#130207 2023-05-27 08:15 ( Edited 2023-05-27 08:16)

:: Unfold ::

Demake of Rogue Legacy 1, work in progress.
Posted here to show my friends.

Cart #minilegacy-0 | 2023-05-02 | Code ▽ | Embed ▽ | No License
2

P#129287 2023-05-02 05:24

:: Unfold ::

Yep. That's it.

Cart #mudebeguso-1 | 2023-03-20 | Code ▽ | Embed ▽ | No License
4

P#127356 2023-03-20 10:30 ( Edited 2023-03-20 10:31)

:: Unfold ::

Hello! I've made a cart on my console and it runs there. But when I upload it onto BBS, it gives a syntax error.

Error:
syntax error line 5 (tab 1)
-return fget(mget(x/8,y/8),f)
<eof> expected near 'end'

Function:

function gfap(x,y,f)
-return fget(mget(x/8,y/8),f)
end

i've marked indent spaces as '-'

Cart #nogafekone-0 | 2023-03-19 | Code ▽ | Embed ▽ | No License

Pico-8 version i made the game at: 0.2.5c

P#127317 2023-03-19 11:27 ( Edited 2023-03-19 11:39)

:: Unfold ::

Cart #twodlineeditor-0 | 2022-11-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

This tool allows you to map lines on a plane and export them into any of your carts.

Each line is represented as a table with values x1,y1,x2,y2.
This is useful for raycast projects or whatever you need to map lines for.

Buttons (left-up corner of the screen, top to bottom):

Temp save: temporarily saves all line data to adresses 0x4300-0x5dff in console memory.
Load: loads data at adresses 0x4300-0x5dff. Can be used as reserve copy.
Toggle ruler: Each line displays it's length to the right of it's 2nd point.
Export: allows you to type in your desired cart's name and export line data to it's addresses 0x4300-0x5dff. This overwrites your cartridge file so make sure you don't have anything valuable in there (sprites, map, sounds and, obviously, code are safe).

Modes: (down side of the screen, left to right):

Click: right-click to select the line and distplay it's info, left-click to deselect.
Pan: left-click drag across the plane to view different parts of it.
Draw: left-click and drag to create a new line at your pointer position.
Delete: left-click near the line to delete it. Lines that will be affected are highlighted red.

Memory:

Each line takes 8 bytes of space (2 bytes per 16-bit variable, 4 variables).
All memory in the aforementioed range is cleared before writing line data.

How to read line data back:

In your original cartridge, you can do something like this:

lines={}
for i=0x4300,0x5dff,8 do
 local x1=peek2(i)
 local y1=peek2(i+2)
 local x2=peek2(i+4)
 local y2=peek2(i+6)
 local line={x1=x1,y1=y1,x2=x2,y2=y2}
 add(lines,line)
end
P#120768 2022-11-15 19:44 ( Edited 2022-11-15 19:58)

:: Unfold ::

How do you deal with range overflow? The numbers beyond 32767 warp to -32766 in pico8's 16 bit signed system when calculating. This is sometimes enough, but not always. For example,

 function distance(x1,y1,x2,y2)
  return sqrt((x2-x1)^2+(y2-y1)^2)
 end

will sometimes (very often actually) return 0 as a result of taking sqrt of the negative wrapped number. This is occasionally crutial. Is there a workaround to compute this as if this was an unsigned system?

P#120638 2022-11-13 22:09

:: Unfold ::

Cart #kekewosoji-0 | 2022-11-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

So i watched lazy devs' youtube shorts about how he makes his shmup levels. In there he mentioned that he has different pico8 cartridges that work as tools for editing stuff like sprites, bullet patterns and level scenery. I coded a 2d space line editor that can be used for raycasting. How can i transfer all lines data to an another cartridge for use? There is a big "lines" table that containes tables with individual line data. I know that you can't transfer actual code or tables between carts so lazy devs should have used something different.

P#120615 2022-11-13 18:52

:: Unfold ::

as a minesweeper i can confirm that this is, indeed, minesweeper.

Cart #kitegijge-3 | 2023-03-19 | Code ▽ | Embed ▽ | No License
1

P#120477 2022-11-11 12:29 ( Edited 2023-03-19 10:32)

:: Unfold ::

Hello everyone. Is there a way to write and read values to specific bits in a byte?
For example:
I have a variable 0x0000 .
I want to write a 1 to the 3rd bit so it'll be
0x0100 . How can i do that?
I want to later read that variable. How do I
check the value of the 3st bit? I haven't operated
with bits & bytes before.

P#120268 2022-11-07 17:55 ( Edited 2022-11-07 18:00)

Follow Lexaloffle:          
Generated 2023-05-30 03:37:11 | 0.098s | Q:36