Log In  
BBS > Lexaloffle Community Superblog
This is a combined feed of all Lexaloffle user blogs. For Lexaloffle-related news, see @zep's blog.

All | Following | PICO-8 | Voxatron | General | Off-site
[ :: Read More :: ]

Cart #tadizihoma-0 | 2024-07-27 | Code ▽ | Embed ▽ | No License

I'm having trouble with my player movement after my map updates. My map seems psuedo-randomize after the 1st screen like I want (I can tinker and fix this later). The trouble I'm having is that my player won't continue moving upwards after the map redraws and resets your position. Essentially every screen seems to treat the lower half as if it's the first screen ie running the collision detection on sprites that don't seem to be there. I'm stumped. Any help would be much appreciated.

P#151824 2024-07-27 00:55 ( Edited 2024-07-27 00:56)
[ :: Read More :: ]

Like the title says, I have rudimentary collision detection on the top and sides of my sprite but not on the bottom.
I'm very new to game dev, but I have some experience in python. I can't see if I have a typo, or I've made a mistake in following the tutorial I watched.

--player--
function create_player()
player={
state="normal",
sprite=1,
health=4,
x=64,
y=82,
h=8,
w=8,
gravity=0.30,
friction=0.15,
inertia=0,
thrust=0.80
}
end

function collide(o)

local x1=o.x/8
local y1=o.y/8
local x2=(o.x+7)/8
local y2=(o.y+7)/8

local a=fget(mget(x1,y1),0)
local b=fget(mget(x1,y2),0)
local c=fget(mget(x2,y2),0)
local d=fget(mget(x2,y1),0)

if a or b or c or d then
    return true
else
    return false
end

end

function move_player(o)
o.y+=o.gravity --applies player gravity

local lx=o.x   --last x pos
local ly=o.y   --last y pos

if (btn(❎)) o.y-=o.thrust --player move
if (btn(⬅️))    o.x-=0.5 
if (btn(➡️))    o.x+=0.5 

--if the player collides, moves back

if collide(o) then
    o.x=lx
    o.y=ly
end

end

function ani_player(o)
if btn(⬅️) then --player animation
o.sprite=2
elseif btn(➡️) then
o.sprite=3
else
o.sprite=1
end
end

function draw_sprite(o)
spr(o.sprite,o.x,o.y)
end

P#151722 2024-07-24 04:54
[ :: Read More :: ]

Hi Pico-8 community! a few months ago I built a pico8 themed VS code extension, it follows the colour scheme of the pico 8 text editor, and I have also added instructions in the read me on how to get the font and the cursor!

You can get it here: https://marketplace.visualstudio.com/items?itemName=mai314.pico-8-theme&ssr=false#overview

or

  1. Open the Extensions sidebar panel in VS Code. View → Extensions

  2. Search for Pico-8 theme by mai314

  3. Click Install

Enjoy!

Screenshot examples

P#151712 2024-07-23 22:25 ( Edited 2024-07-23 23:03)
[ :: Read More :: ]

In "> Pico Hack_" you are a freelancer Hacker who take jobs for corporations.
You can be a Black Hat or White Hat. It is your choice.

Any comments, criticisms or ideas are welcome :)

Cart #snake_phack-1 | 2024-07-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#151623 2024-07-22 07:20 ( Edited 2024-07-22 07:27)
[ :: Read More :: ]

Sorry if this is a completely dumb question. I'm new to Pico 8 and game dev in general. I'm stuck in my first project attempting to randomize map layouts. My game is a simple vertical scrolling game where the player moves from side to side to avoid obstacles. I'd like to begin on one screen, and then end on a final screen with the ones in between being a random selection from the 12 or so other screens I've drawn. I know the easiest way to do this is probably with nested tables, but I'm having trouble understanding how I could accomplish this. Any help would be awesome.

P#151615 2024-07-22 00:06 ( Edited 2024-07-22 12:14)
[ :: Read More :: ]

I wanted a tool to help me import a large folder of asset .pngs (such as one you might get from https://kenney.nl/) into .gfx files. I know there are tools such as @pancelor 's helpful importpng.p64 (or just click-n-dragging onto the gfx editor), but I didn't want to do that for hundreds of files.

Using importpng.p64 as a foundation, I create a command-line utility for Picotron that will import entire folders of assets into .gfx files! Below is the snippet that you'll put in /appdata/system/utils/simport.lua

-- a tool to import all pngs in a folder into a single .gfx file
-- tool by  @fletch_pico
-- version 1.1
-- 
-- makes use of:
-- importpng.p64 code by     @pancelor
-- https://www.lexaloffle.com/bbs/?tid=141149

cd(env().path)
local argv = env().argv

if (argv[1] == "--help") then
    print("Usage: simport [FOLDER]")
    print("Populate the .gfx file using a folder of PNGs.")
    print("")
    print("OPTIONS")
    print("  -e")
    print("  --empty-sprite-0")
    print("  keep sprite 0 empty on every .gfx file")
    print("  (default is to write data to sprite 0)")
    exit(0)
end

-- check if argv[1] is a folder
local path = fullpath(env().argv[1])
if (not path) then
    print("could not resolve path")
    exit(1)
end

-- loop through items in this folder looking for pngs
local dir_items = ls(path)
local pngs = {}
for i=1,#dir_items do
    local item = dir_items[i]
    if (#item > 4 and sub(item,-4) == ".png") then
        add(pngs,item)
    end
end

if (#pngs < 1) then
    print("no PNGs found, exiting early...")
    exit(1)
end

if (argv[2] == "-e" or argv[2] == "--empty-sprite-0") then
    local i = 0
    while i < #pngs do
        add(pngs, "empty", i+1) -- gotta add 1 because pngs is not 0-indexed here
        i += 256
    end
end
-- ------------------------------------------
--     @pancelor's importpng.p64 code starts here
-- ------------------------------------------
function sprite_from_image(png_path)
    local img_i32 = fetch(png_path)
    if not img_i32 then return nil end

    local rgb = {}
    for i=0,31 do
        rgb[i] = rgb_from_int(peek4(0x5000+i*4))
    end

    local w,h = img_i32:attribs()
    local img_u8 = userdata("u8",w,h)
    for i=0,w*h-1 do
        img_u8[i] = best_match(rgb,img_i32[i])
    end

    return {
        bmp=img_u8,
        flags=0x0,
        pan_x=0,
        pan_y=0,
        zoom=8
    }
end

local _memo={}
function best_match(rgb,now_i32)
    local res=_memo[now_i32]
    if res then return res end

    local now = rgb_from_int(now_i32)
    local v,k = minby0(rgb,function(cvec)
        cvec -= now
        return cvec:dot(cvec) --distance squared to now
    end)

    _memo[now_i32]=k
    return k
end

-- rgb: vec(r,g,b), each in [0,1] range
-- returns: 0xRRGGBB
function int_from_rgb(rgb)
    return (rgb.x*255\1<<16)+(rgb.y*255\1<<8)+(rgb.z*255\1)
end

-- int: 0xRRGGBB
-- returns: vec(r,g,b), each in [0,1] range
function rgb_from_int(int)
    return vec((int>>16&0xff)/255,(int>>8&0xff)/255,(int&0xff)/255)
end

function minby0(arr, fn)
  fn = fn or function(x) return x end
  local best,besti = fn(arr[0]),0
  for i=1,#arr do
    local now = fn(arr[i])
    if now<best then
      best,besti = now,i
    end
  end
  return best,besti
end
-- ------------------------------------------
--     @pancelor's importpng.p64 code stops here
-- ------------------------------------------

-- loop through pngs table and start copying their userdata
local total_files = #pngs
local idx = 0

-- core loop - get a png userdata, copy to .gfx, go next
local gfx_data = {}
for i=0,flr(#pngs/256) do
    -- create a new gfx "page"
    gfx_data[i] = {}

    -- calculate how many sprites are in this page
    local num_sprites = #pngs-(i*256)

    -- loop through each sprite and populate the current page
    for j=0,num_sprites-1    do
        -- check if this is the "empty" sprite
        if (pngs[i*256+j+1] == "empty") then
            gfx_data[i][j] = {
                bmp=userdata("u8", 16, 16), -- empty 16x16 userdata
                flags=0x0,
                pan_x=0,
                pan_y=0,
                zoom=8
            }
        -- this is a real file to attempt to import
        else
            local data = sprite_from_image(path.."/"..pngs[i*256+j+1])
            if (data ~= nil) then
                gfx_data[i][j] = data
                print("imported "..pngs[i*256+j+1].." ("..(i*256+j+1).."/"..total_files..")")
            else
                print("failed to import "..pngs[i].."; continuing")
            end
        end
    end
end

-- write to gfx file(s)
for i=0,flr(#pngs/256) do
    print("storing "..i..".gfx")
    store(path.."/"..i..".gfx", gfx_data[i])
end
P#151555 2024-07-20 20:44 ( Edited 2024-07-21 09:09)
[ :: Read More :: ]

How many of you guys use external editors (like vscode, atom, or sublime). I'm curious to know how other people make Pico-8 games, since I use vscode with several plugins and it's honestly a lot nicer than the built in editor.

P#151554 2024-07-20 20:31
[ :: Read More :: ]

Cart #jugudirinu-0 | 2024-07-17 | Code ▽ | Embed ▽ | No License
1

P#151430 2024-07-17 23:57
[ :: Read More :: ]

Cart #malte_brun-1 | 2024-06-16 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


Madeline ventures into Oceania to conquer one of New Zealand's tallest mountains, Malte Brun.

I finally figured out how sprite flags work!
This is my second ever Celeste mod and technically my first mod with new mechanics.
Credit to the Evercore team for making the base cart and Antibrain for making the slab code.

P#149998 2024-07-16 04:08 ( Edited 2024-07-16 04:08)
[ :: Read More :: ]

Cart #sefamiruze-0 | 2024-07-15 | Code ▽ | Embed ▽ | No License

Teaching lil bro how to use pico 8 and this is the second game he helped make

P#151338 2024-07-15 01:28
[ :: Read More :: ]

Cart #gajibugamu-0 | 2024-07-12 | Code ▽ | Embed ▽ | No License

why are you here

P#151230 2024-07-12 17:48
[ :: Read More :: ]

hello

P#151166 2024-07-11 09:31
[ :: Read More :: ]

Cart #ruroripeku-0 | 2024-07-10 | Code ▽ | Embed ▽ | No License
1

P#151095 2024-07-10 02:08
[ :: Read More :: ]

How To Make It Work? First Put Your Resolution To 720x480 Pixels then

Make Sure Only The Desktop Is Running And Web Browser Then Try These Links

Pizza Tower ETB Web Port
Pizza Tower April 2019 Web Port
Pizza Tower Pre Sage 2019 Web Port

Note: Also One Tab And No Virus's

P#150941 2024-07-06 21:38 ( Edited 2024-07-06 21:40)
[ :: Read More :: ]

Cart #wohomemaje-0 | 2024-07-06 | Code ▽ | Embed ▽ | No License
1

needs a mouse!

P#150916 2024-07-06 00:56
[ :: Read More :: ]

Cart #rasoruzaju-0 | 2024-07-04 | Code ▽ | Embed ▽ | No License

P#150855 2024-07-04 23:59
[ :: Read More :: ]

Cart #mepidabedo-0 | 2024-07-04 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

P#150810 2024-07-04 01:20
[ :: Read More :: ]

I'm trying to change my email, so tried to change it through my account settings. After I put the new email in the email field, I get an confirmation email, but when I click at the confirmation link that's sent to that email, the bbs email doesn't change, I just get log out from my account. Pls help!

P#150680 2024-07-01 15:54 ( Edited 2024-07-01 22:51)
[ :: Read More :: ]

my request
here are some fragments of the game code

if collectibletype==colt_ring then
s.score=100
end
add(entities,s)
return s
end
function collectible_update(s)
end

now if on one level I have 3 rings the same and for each ring I get 100 points
I would like to change the code to something like this
if collectibletype==colt_ring then
s.bonus+=1 end
if s.bonus=1 then s.score=100 end
if s.bonus=1 then s.score=200 end
if s.bonus=1 then s.score=400 end
so that for getting the first ring in any order there would be 100 points, for the second 200 points, third 400 points

P#150600 2024-06-29 18:34
[ :: Read More :: ]

Sosaseessosasees

P#150585 2024-06-29 11:13
View Older Posts