The code is showing a "attempt to preform arithmetic on global 'X1' ( a nil value)" line 30 tab 2. I have tried everything and nothing fixes it. Any suggestions is much appreciated. Please not that the code is not done yet.
pico-8 cartridge // http://www.pico-8.com
version 16
lua
--variables
function _init()
player={
sp=1,
x=59,
y=59,
w=8,
h=8,
flp=false,
dx=0,
dy=0,
max_dx=2,
max_dy=3,
acc=0.5,
boost=4,
anim=0,
running=false,
jumping=false,
falling=false,
sliding=false,
landed=false,
}
gravity=0.3
friction=0.85
end
-->8
--update and draw
function _update()
player_update()
--player_animate()
end
function _draw()
cls()
map(0,0)
spr(player.sp,player.x,player.y,1,1,player.flp)
end
-->8
--collisions
function _collide_map(obj,aim,flag)
--obj
--aim left right up down
local x=obj.x local y=obj.y
local w=obj.w local h=obj.h
local x1=0
local y=0
local x2=0
local y2=0
if aim== "left" then
x1=x-1 y1=y
x2=x y2=y+h-2
elseif aim=="right" then
x1=x+w y1=y
x2=x+w+1 y2=y+h-1
elseif aim=="up" then
x1=x+1 y1=y-1
x2=x+w-1 y2=y
elseif aim=="down" then
x1=x y1=y+h
x2=x+w y2=y+h
end
end
--pixels to tiles ** <----- This is the error**
x1/=8 y1/=8
x2/=8 y2/=8
if fget(mget(x1,y1), flag)
or fget(mget(x1,y2), flag)
or fget(mget(x2,y1), flag)
or fget(mget(x2,y2), flag) then
return true
else
return false
end
-->8
--player function
function _player_update()
--physics
player.dy+=gravity
player.dx*=friction
end
--controls
if btn(⬅️) then
player.dx-=player.acc
player.running=true
player.flp=true
end
if btn(➡️) then
player.dx+=player.acc
player.running=true
player.flp=false
end
--slide
if player.running
and not btn(⬅️)
and not btn(➡️)
and not player.falling
and not player.jumping then
player.running=false
player.sliding=true
end
--jump
if btnp(❎)
and player.landed then
player.dy-=player.boost
player.landed=false
end
--check colldie
if player.dy>0 then
player.falling=true
player.landed=false
player.jumping=false
if collide_map(player,"down",0) then
player.landed+=true
player.falling+=false
player.dy=0
player.y-=(player.y+player.h%8)
end
elseif player.dy<0 then
player.jumping=true
if collide_map(player,"up", 1) then
plater.d=0
end
end
--check collide l and r
if player.dx<0 then
collide_map(player,"left",1) player.dx=0
elseif player.dx>0 then
if collide_map(player,"right",1) then
player.dx=0
end
end
--stop sliding
if player.sliding then
if abs(plater.dx)<.2
or player.running then
plager.dx=0
player.sliding=false
end
player.x+=player.dx
player.y+=player.dy
end


Description
A de-make of the world's most loved and hated game of all time. De-made with a few extra features such as a high score counter, a death counter, and an extra birb color (green)
Controls
Flap
Press ⬆️, 🅾, ❎, ⏸ or up arrow key, Z, X, P to flap ya wings!
Credits
@rnd (making the PCM sampler)



Hi. i found that code https://mboffin.itch.io/pico8-overlap
that checks for overlap.
But my initial thought was in term of sprites.
Since we can define sprites is there a simpler way to detect
when one sprite touched or overlapped another?




I've seen that some people have made their own boot animation carts, but I would like to make my own, and have it where it will run a command at the end of the animation that makes Pico 8 boot into splore.
This is how it could work in a dedicated Pico 8 machine:
Turn on machine > autorun Pico 8 via bash script or something else with the -run animationcart.p8.png command at the end> animation runs > code at end of cart executes extcmd(splore) or another command that makes Pico 8 go to splore.
I've came up a idea to go around doing this, but it is too clunky. I could make a bash script that runs 2 instances of Pico 8 at the same time. One will boot into Pico 8 and run the cart, but shutdown that instance of Pico 8 afterwards, then the other Pico 8 instance would still be running and be in splore.
I would like to see this added in a future version of Pico 8 if possible. Thanks for making Pico 8 and have a great day.


this is the start of my attempt to make a rhythm-based game
I apologize for the poor musical skills
v2: new spriteset, bug fixes, you can now die. (the effect is from Star Anise, but will change https://www.lexaloffle.com/bbs/?pid=76334#p)


Hello again. I've been working on different ideas for running Pico 8 games on physical media.
I've tried SD cards and while they are cool and can function as cartridges, they tend to have too much storage and I find that wasteful when Pico 8 games are less than a megabyte. I have been experimenting with other ideas such as using 3.5" floppies. They are much more smaller in storage compared to a SD card, but they have their own setbacks.
What would you recommend I try to use as physical media for Pico 8 games? I could try ROM cartridges, but they will probably be the most expensive route and be the most complicated.
Here is a picture of a Pico 8 game I put on floppy.

The tutorial I made for mounting SD cards 'should' work for floppies with slight changes.
https://www.lexaloffle.com/bbs/?tid=44530
I'm not going to sell Pico 8 games that aren't mine on physical media, I'm just trying out new ideas.








taipei1k # game in 1023 bytes
protect taipei! destroy the aliens & avoid the bullets.

type: game (demo)
size: 1023 bytes
features:
- galaga-like gamemechanic
- gamemechanic
- procedural sprites
- procedural music
enjoy
CONTROLS
←→ arrow keys
move between frames
↑↓ arrow keys
change animation speed
zx change draw color
ABOUT
I started this project on a 3 hour plane ride where I finished most of it project and had a lot of fun with it. A couple months later and I finally managed to get back to it to add saving/loading, bug fixes, onion skins and sound effects! I hope you enjoy this as much as I have while working on it ♥
If you enjoy it please consider donating so I can eat and pay rent 🙏
You can donate here: https://voxeledphoton.itch.io/aniwiggle


The PICO-8 manual as it stands today is flawed. What I mean by that is not only is it organized in such a way that makes it harder to gleam certain information out of it, but it also has flaws and inconsistencies with what the PICO-8 actually is. It also omits important information, such as cycle count and the extra 16 colors. eevee has already taken note of some of these flaws, but I still believe there may be more out there. There's the PICO-8 wiki, but that's not fully documented either. What we need is a new way of organizing known information about the PICO-8 into a manner which makes sense and is simple to use.
I propose the creation of a PICO-8 technical manual, a manual that fully documents everything the community knows about the PICO-8, both it's version of lua and it's editors, as well as the programs on it. It will be a collaborative project. Alternatively, we could fix the current PICO-8 wiki in such a way that it accounts for these flaws, is more detailed and easier to use. Both of these options I think could really help people like me who wish to delve deeper into how it works exactly.





Figured Pico-8 needed a Burgertime! This is a Burgertime demake, it uses about half the resolution of the original. I tried to make it as true to the arcade version as possible. Includes all 6 levels, as well as the level 28 kill screen.
Did my best on the AI for the enemies and speeds, but with the size differences, and a few other things, probably plays slightly different than the bigger arcade version- but pretty close! I also tried to reproduce some of the bugs- for example it only shows up to level 18 in the HUD (3 times through the levels), as well as 9 lives, even though you can get more lives and keep going- just like the original.
This was one of my favourites on the Intellivision back in the day, so enjoy!



THIS ERROR HAS BEEN RESOLVED (09-13-21)
Closing error ticket.
I was running into an error in the newest version of Pico-8.
If you have this code:
function _init() cls() for i=1,8 do a=rand(1,2) print(a) end end function rand(a,b) if (a>b) a,b=b,a return flr(a+rnd(b-a+1)) end |
And run it. It works fine in all versions of Pico-8.
However if in immediate mode you type:
print(rand(1,2)) |
It works just fine in version 0.1.12c but you get an ERROR message in version 0.2.3.
It does not matter if the functions come before _init() you get the same results.
If I read this correctly it means we cannot use immediate mode to debug our functions in the newest version whereas in the earlier version, you could. I personally need this so I can check my functions in immediate mode to make sure they are working correctly.
Version 0.1.12c is the latest version where it works correctly; you can call functions in immediate mode. All versions after this up to 0.2.3 will not let you. I checked and confirmed this.
Amika's Quest is a roguelite Zelda-like!
Controls:
X (X, V or M on a keyboard): Sword
O (Z, C or N): Item
Pause (P): Open menu
Once items are purchased, you can switch between items in the pause menu


Credits:
Design and coding: Tyler Davis
Character design: Te'shon Farr
Music: Cory Shane Davis





I've been working on a project for a week or so, and my PC crashed. When I loaded up Pico again it would not let me load the file. I simply get a 'could not load' message.
I can see the file clearly and even if I try to open through the file itself, it simply tells me again that it can not load the file - so either it has become corrupt or there's something else, but it is working totally fine before the PC crashed.
Any help is appreciated!


Conways Game of life
Created by Duffhause
Cart
Controls
You can only move cursor and toggle tiles while the game is paused
- Move cursor with arrow keys
- Press X to toggle a cell
- Press Z to play and pause
Code
You can view the code on Github

Chain portals together to collect all the gold!
Portal Golf is a physics puzzle game with portals. Place portals around the level in order to get the ball to collect every gold bar. You have no control over the movement of the ball and can only place portals before you start the run. Try to use as few portals as possible to earn medals, or just fill the whole level with portals and have fun!
Detailed Instructions are in-game
Controls:
- Left click on any wall with a white edge to add a portal
- Left click and drag an existing portal to move it somewhere else
- Right click to delete an existing portal
- Press C to start or stop a run





Hello!
I am going a bit mad trying to figure out how to make a simple 4 frame sprite animation run on a loop, and then transition to a different 4 frame animation loop after a button is pressed.
Simply - I am trying to make this Mario sprite look like it is walking forward when idle, or pressing forward, and then look like he is walking sideways when pressing left or right. I can make him animate on loop when idle, but I cannot figure out how to make it animate as a different sequence after a direction is pressed, and ensure the animation runs smooth (for example, I can get it to change to the new sequence, but holding the button down keeps the sequence locked into the first frame of the animation).


