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


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 2020-10-25 11:26 | 0.106s | 4194k | Q:63