Log In  
Paul Knight

Having a bash at coding 30 years after I dabbled on the Vic 20, Spectrum, Atari ST etc... Tried python, but the self contained IDE offered by Pico-8, the retro feel, and imposed limitations are appealing - developing something for this platform will be much more fun, and much, much more achievable! I'm all about learning on lo-fi stuff, and progressing from there, although with the big community that seems to be popping up around Pico-8 development, why would I want to move on!! Fun, Fun, Fun ;-)


Just wondered if anyone knows how I can calculate the number of days between a date assigned to a variable (or 3 variables actually) and the current date please?

I have googled around and now know that I can use the following to get the current date in Pico8:


And if I set up three variables to hold a date in the past e.g.


How can I easily work out the number of days between the 2 dates please, or do I need to work up some code to acknowledge the different number of days in various months, and work it out like that? Sounds fiddly!!

Any help much appreciated :-)

Thank you!

P#87953 2021-02-20 23:47


Just came across this!


Wonder if anyone could ever get PICO8 running on this little machine!

Ultimate portability :-)


P#86644 2021-01-21 12:31

Cart #niwotihpo-0 | 2020-11-19 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#84467 2020-11-19 01:13


I'm pulling together a simple animation that shows some electrochemical concepts.
I've managed to get an "ion" moving around a simple electrochemical cell (anticlockwise flow) using some random movements with some bias to help "push" the ion in the right direction to simulate flow. Its not perfect and there are no doubt much simpler ways to do this, but my coding skills aren't up to it so I've hacked this together - please excuse the mess!

Anyway, I am trying to get the white "ion" to turn green when it hits the electrode (aka grey box) and stay green. I'm doing this by checking if the "ion" is within the bounds of the electrode, and also that the electrode is powered up (variable pwr=1). As far as I can see, it should work, but after literally hours trying to figure out why its not working, I'm close to giving up, and thought I'd see if I was missing a really obvious thing - as I say, I'm not a good coder, just muddle by!

Any help would be very much appreciated.

All the best,

PS: another problem that I've not fixed is the switching on/off of the power to the electrode. Should be done using a simple btn press, but for some reason this isn't working either. Again, any suggestions much appreciated. Thanks :-)

Cart #gunukuzibu-0 | 2020-11-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#84232 2020-11-14 15:33 ( Edited 2020-11-14 23:37)


I am working on a small cart to demonstrate an engineering process for a colleague who wants to spice up a PowerPoint presentation he is giving.

Does anyone know if its possible to embed a Cart (in HTML format??) into a PowerPoint presentation so that he can run it from within his presentation?

Any help much appreciated.

All the best,
Paul :-)

PS: Am asking here since I can't test this as I use a Mac and don't have PowerPoint! Thanks :-)

P#84204 2020-11-13 21:09 ( Edited 2020-11-13 22:24)


I'm a part time tinkering when it comes to coding - just dabbling now and again, and I wondered if anyone had any ideas on how to speed up the following code please?

I want to draw a screen full of random CHR$ characters, but this method is taking approx 13 seconds to run!

function _init()

function _update()
if i>=120 then
if b>=125 then

Any help would be much appreciated :-)

Thank you

P#82922 2020-10-14 06:57

Cart #dijikehutu-0 | 2018-11-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Very basic!

Avoid the crabs and collect the gold to get the highest score.

Simple :-)

Thanks for looking

P#59424 2018-11-28 20:02 ( Edited 2018-11-28 20:14)

This is very much a work in progress, and is really to try out a few ideas.

Basically, it allows you to see the impact on total spends of a project portfolio (fixed to 3 at the moment) at a particular time, if individual projects are moved within the overall scheduling of the projects.

To move projects along the timeline, use the up/down cursors to move the orange pointer to the project you want to move, then the left/right arrow keys to move it back and forwards on the timeline.

Once the projects have all been scheduled, move the orange pointer up to the "Timeline Zone" and the left/right arrow keys will move the red "timeline now" line along the project schedule. The total cost of the projects at that point will be show at the bottom of the screen, together with the total project cost when all projects have been completed.

A spend profile (the rate at which money is spent) is overlaid on the project timelines, and moves in real time as the individual projects are moved.

For now, individual projects have a fixed duration (hard coded), and it is assumed that the total cost of each project is spend linearly. I want to add flexible cost rates so for example, a project spend rate can be set to relatively low at the beginning and end of a project, with a higher spend rate in the middle of a project, when the work is really in full swing.

Lots more to do including autoscaling of the project spend profile, individual project spend profiles (rather than assume linear spend), on-the-fly changes to individual project parameters e.g. total value, duration etc...

Anyway, this cart will likely have very limited appeal to most, but I thought I'd post it anyway!!

Thanks for looking,

P#59273 2018-11-21 15:03 ( Edited 2018-11-25 11:42)

This is my first posted cartridge.

Its just a concept at the moment, to see if a fun game could even be made from it.

Basically, you need to collect the sample vials (much better collision detection needed) before you are irradiated by too much radiation.

As you move around, you build up a radiation map to help you avoid radiation "hot spots".

There are 3 radiation sources, and you can also mark them up by clicking on them using the mouse when you think you know where they are.

Pressing Z actually shows where they are (this would not be enabled if I made a game from it) and X hide the sources again.

Anyway, all comments much appreciated :-)

Thanks for looking!

P#50557 2018-03-18 05:49 ( Edited 2018-03-18 09:49)

Cart #42682 | 2017-07-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


I was hoping someone might be able to help me with a 'newbie' question please.

I want to be able to move a mouse pointer around, and then when the mouse is clicked, record the x and y position and place a sprite in that position. The next time the mouse button is pressed, a second sprite is displayed at the new mouse position, and then finally, a third upon another mouse button click. Further mouse button clicks will then re-position the first sprite and so on......

This should leave 3 sprites on the screen, and record their positions.

The current code does this, and displays the x/y position of each sprite. The problem I have is that a single "mouse click" event is hard to make and the code loops round very quickly making discrete sprite positioning difficult.

Can anyone please suggest a way to remedy this?

Any help would be much appreciated.

Kind regards,
Paul :-)

P#42683 2017-07-21 15:57 ( Edited 2017-07-25 11:50)

Hi all.

A newbie question!

I am using the PGET command to read the value of a pixel as you move a point around the screen.

The code I have written seems to work fine in the X axis, but the y-axis is offset for some reason.

If you move the point over the yellow square from left to right, the PGET command successfully reads the pixel colour value.

If you move the point over the yellow square from top to bottom, the PGET command is offset by approx 6 pixels.


Am I missing something?

Any advice would be very much appreciated.

Many thanks

Paul :-)


Code pasted below.


function _update()
if btn(1) then x=x+1 end
if btn(0) then x=x-1 end
if btn(3) then y=y+1 end
if btn(2) then y=y-1 end

function _draw()
rectfill (0,0,124,124,0)
rectfill (50,50,70,70,10)

P#40796 2017-05-20 10:46 ( Edited 2017-05-21 20:22)


I've been dabbling in Pico-8 since yesterday and am loving it so far! However, I have come up against a really frustrating problem and have spent hours trying to figure out why my code doesnt work. I keep getting a
"then" expected near "=" error up, for the line highlighted in the code below. Any ideas of why this isn't working would be very much appreciated!!!

All the best,

player = {}
player.x = 5
player.y = 5
player.sprite = 0
player.speed = 2
crab = {}
crab.x = 50
crab.y = 50
crab.sprite = 9
crab.ran = 1

function mover()
player.moving = true
player.sprite += 1
if player.sprite > 4 then
player.sprite = 0

function movel()
player.moving = true
player.sprite -= 1
if player.sprite <4 then
player.sprite = 8

function crabmov()
crab.ran = flr(rnd(2))
if crab.ran = 0 then <------------------
crab.x -= 1
if crab.ran = 1 then
crab.x += 1

function _update()
player.moving = false

if btn(0) then
player.x -= player.speed
if btn(1) then
player.x += player.speed
if btn(2) then
player.y -= player.speed
if btn(3) then
player.y += player.speed
if not player.moving then
player.sprite = 0

-- decide if the crab moves left or right


function _draw()
rectfill (0,0,128,128,13)
spr(player.sprite, player.x, player.y)
spr(crab.sprite, crab.x, crab.y)


P#26080 2016-07-29 09:05 ( Edited 2016-07-29 15:11)

Follow Lexaloffle:        
Generated 2021-10-18 21:13:57 | 0.126s | Q:31