Bug #1:
The built-in tuple "..." seems to confuse the syntax highlighter. Notice "END" isn't pink:
Not a big deal, but I figured you'd want to know.
Bug? #2:
Maybe a bug, maybe not. I just noticed that Ctrl+H goes to the start of the document (as with Ctrl+Home). On the other hand Ctrl+E goes to the end of the current line (as with plain End). Is this difference in behavior intentional? If so, no big deal. I just wanted to be sure it was intended vs. accidentally calling the wrong internal "home" or "end" function for one of them.
EDIT: Just as I posted this, I noticed that it's ^W/^E for line home/end, so I guess this probably isn't a bug. Disregard #2.
This is a Game of Life implemented by Pico-8.
- Press X to change a cell to live or dead
- Press C to start evoluation.
The evlove follows four rules listed below:
- Any live cell with fewer than two live neighbours dies, as if by underpopulation.
- Any live cell with two or three live neighbours lives on to the next generation.
- Any live cell with more than three live neighbours dies, as if by overpopulation.
- Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
Some specific pattern will cause something interesting.For example:
This pattern will keep moving and can always keep the original form.
You can see more detils for game of life in LifeWiki
Let's give it a try.
This is a Cellular Automaton implemented by Pico-8.
Each cell has 3 states, empty, blue or red, is encoded as 0,1,2.
Everything with three states can be simply simulated by this simulator.
You can think of it as the three states of a tree, dead, normal, or burning.
Of course,it can also be interpreted as human death, healthy or illness.
The probability of each cell state transition is related to the state of surrounding cells. The more surrounding red cells, the higher the probability that the cells will turn red. The more blue cells around you, the higher the chance that the cell will turn blue.
press x to change a cell from state 1 to 2, or press z to change a cell from state 2 to 1.
The state transition probabilities are written in the function _init(), Where p01 represents the probability of transition from state 0 to state 1.
You can try to modify it and observe the evolution results.
Each time _update () is executed, it will perform state transition on each cell according to the transition probability.
Hi everyone!
I'm hard at work on a 1-4 player cart, but I've run into a snag when it comes to moving a sprite around in a circle.
I more or less have the movement down (thanks to tonechild), but it looks like the wrong part of the sprite is tracing the circle I want:
(Please excuse the incomplete graphics and such.)
It appears that the upper-left corner of the sprite is tracing the circle here, when I'd really prefer something closer to the center of the sprite. Is there a way to make this happen? Or, if not, is there a workaround any of you might recommend?
Here are the relevant points of my (messy) code. You'll notice the star is able to "trace" the track because it uses the same variables I used to draw the circle.
--variables scene="logo" last=time() game_over=false --determines that a solo player has lost player_win=false --determines that a player won in multiplayer [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=73965#p) |
Thought it'd be fun to share this.
An attempt at capturing even the smallest amount of joy my dog gets from playing fetch.
- Left/Right to run
- X to jump
- Z to bark
- Down to sit
[0x0] | |
Hello, first post here.
I just got started with Pico-8 recently, and have learned about the usefulness of storing data in strings to get around token limits. I was wondering, can I build a data string using a p8 program, then output that string as text that can be fed into another p8 program without it being reformatted? I'm working on a graphical level-editor program that will output level data strings usable by another cart.
I tried using printh(), but when I opened the text file it mangled up the extended character glyphs and didn't preserve the 4x3 font lower-case letters I had in the string. My goal is to have all 121 characters available so I can store about 7 bits per character, instead of the 4 possible with hexadecimal, if this is possible.
Thanks.
Hey everyone! This is a Work-In-Progress of my first PICO-8 game, Super Breakout! It only comes with 8 simple levels, but features a fully-functional level editor so that you can create and share your own levels! I still need to add audio, create more levels, and generally polish things up before I'd call this "done." I'm looking for feedback on anything you want to comment on. I'd also love to play any levels you create! Just share the level code in a comment :)
Controls
In-game
- Left & Right Arrows - Move
- C | Z - Boost
- V | X - Launch glued balls
- Up Arrow - Reset balls
- Down Arrow - Restart level
Level Editor (mouse required)
Repro:
- fire up PICO-8
- switch to code editor
- type something like 123456789 and hit enter
- copy and paste that line few times to give yourself something to cursor through
- using the keyboard, navigate to the middle of one of these lines
- cursor up and down: should work normally
- click near the start or end of the line
- cursor up or down: will change the row properly but maintain the column from before the click
Demo:
This is probably as easy to fix as just setting both the current and virtual column on mouse clicks.
So I find that organizing my code with data structures and functions adds a lot to the runtime cost in PICO-8.
For example, doing vector math with objects like {x=1,y=2}, and functions like
function vadd(v1,v2) return {x=v1.x+v2.x,y=v1.y+v2.y} end |
greatly increases the readability of my code, but at the cost of significant performance hit.
Coming from a C++ background, this really upsets me. Modern C++ compilers are extremely good at optimising, and it's often possible to write very expressive code with almost zero overhead. While in PICO-8, if I want my code to go fast, I have to write it in a rather repetitive and messy way.
I like how PICO-8 is deliberately restrictive, but is there a way to write clean code without hurting performance too much? What are your thoughts?
i've been running into some strange errors involving a project using #include while running it on windows instead of my usual linux environment. i've isolated the problem to line ending convention: an external file that uses the windows CrLf convention, but is otherwise the same as a file that works with no problems, will cause errors. here is the text of the external file i used:
local function _draw() cls(1) end |
to see the problem, save this with an external text editor using windows line ending convention (wordpad works, as do many programmer text editors) and use #include to include it in a cart.
The heavens receded like a scroll being rolled up, and every mountain and island was removed from its place. Then the kings of the earth, the princes, the generals, the rich, the mighty, and everyone else, both slave and free, hid in caves and among the rocks of the mountains. They called to the mountains and the rocks:
“SAVE US FROM THIS DEMON!"
.....
Score the number of the beast
to release the world from
PONGATORY!
Controls:
Left & Right to move.
X to serve.
Check it out on itch!
Turn with the left and right arrows keys.
If you fall to the ground you can restart the cart (⏸ -> "reset cart").
x=9y=9u=0v=0 function _update60()cls(7)v+=.07l=sqrt(u*u+v*v)a=atan2(u,v) if(btn(0))a+=.014 if(btn(1))a-=.014 w=.03-cos(a*2)/50u=l*cos(a)v=l*sin(a)x=(x+u+8)%144-8 y+=v if(y>120)u*=.9v/=-2y=120 for b=a-w,a+w,w*2 do e=x-8*cos(b)line(x,121,e,121,6)line(x,y,e,y-8*sin(b),0)end end |
Annotated:
This is just a small loop I've been working on which I plan to put in one of my games, but thought I'd upload it to see what others think. It doesn't use any custom instruments and so far any additional layers I've attempted to add (drums, other melodies, etc.) haven't really sounded right. I'm curious if folks think this loop stands on its own enough or if it would become annoying to listen to after a while. Any general feedback is welcome.
Right now if you want to draw a line loop with the cool line(x,y) continuation method, you still have to do at least one line(x0,y0,x1,y1) first to make it work:
-- draw a simple triangle line(32,96,96,96) -- base line(64,32) -- right side line(32,96) -- left side |
This isn't so bad if you're drawing the figure manually as I just did. But if you're, say, drawing an algorithmic figure's loop, you have to handle that first line conditionally within the loop:
-- draw a simple segmented circle local cx,cy,r=64,64,32 for a=0,1,0x.01 do local x,y=cx+cos(a)*r,cy+sin(a)*r if a==0 then line(x,y,x,y) -- sets the continuation point else line(x,y) -- continued from the last point end end |
Or (not shown) you can remove the condition from the loop, but it requires doing math to get the first point outside of the loop and then calling line(x,y,x,y) as above before looping over the subsequent points.