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

Hi! I got pico-8 with the itch bundle a few weeks ago, and this was the first thing I made, it's a little snowboarding game, right now all you can do is try to avoid crashing into things, and there's no consequences when you do, but I think it's pretty cool for a couple of days work.

Cart #snowboard1-0 | 2020-06-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#78556 2020-06-26 21:48 ( Edited 2020-06-26 21:48)

I was wondering what colors were useable for the background and when I went to go look I was sad because darkgreen wasn't useable :| I was wondering if more colors that aren't used for text colors could be background colors! IDK it's not really important but I would love a darkgreen background option.

[EDIT: forgot that the mouse has dark blue when pal swapped img. : o]

P#78552 2020-06-26 19:16 ( Edited 2020-06-26 19:29)

Cart #ultrabreakout_-1 | 2020-06-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Left and Right arrow keys to move paddle, press Up or mouse key to launch!

Inspired by the 70+ video playlist by Lazy Devs, I'm happy to share with you the results of my first real game project.

Ultra Breakout features 10 levels and multiple control options including mouse and touch. There is a slight point advantage to using the standard controls and a slight point disadvantage to using mouse controls.

I hope you enjoy the quick diversion and checkout the original project here. Good luck breaking your personal highscores!

P#78548 2020-06-26 17:51 ( Edited 2020-06-26 19:43)

Hi everyone, I'm fairly new to programming and Pico8.

I'm trying to add powerups to one of my games. I've made an empty table and a function to create each powerup within it.
The problem I'm having is that I'd like one single random powerup to be created depending on the score (say when score==5)

I've managed to do this but the problem was that a second powerup gets created before the player has the chance to up the score.
I've tried to use time() and also creating a boolean but I haven't managed to get 1 single powerup on screen at a time, I either get more than one or nothing.

What would be the best way to do this?

here's the code I have at the moment:

function _init()
    score=0
        powerups={}
end

function _update()
        if score==5 then
        powerup=true
    end

    if powerup==true then
        create_powerup()    
    end
end

function _draw()
         for capsule in all(powerups) do
        spr(capsule.sp,capsule.x,capsule.y)
    end
end

--powerups

powerups_start=5
total_powerups=4
fall=1

function create_powerup()   
    capsule={
    sp=powerups_start+flr(rnd(total_powerups)),
    x=flr(rnd(100)+20),
    y=flr(rnd(10))+20
    }
    add(powerups,capsule)

    powerup=false

    if powerup==false then
        del(powerups,capsule)
    end                         
end

function update_powerup()
    for capsule in all(powerups) do
        capsule.y+=fall

        if capsule.x>=player.x and
                    capsule.x<=player.x+player.w and
                    capsule.y==player.y-player.h then
                        sfx(2)
                     lives.left+=1
                     del(powerups,capsule)
        end 

        if capsule.y>128 then
            del(powerups,capsule)
        end 
    end
end 

Thanks in advance!

P#78545 2020-06-26 17:08

Cart #simple_circuits-0 | 2020-06-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

A simple game about fixing very simple circuitry.

Hopefully it should be fairly self explainitory but you might have to do a little thinking for yourself.

Made in two weeks, a twofold task to myself - get it done in time (I originally intended 1 week but that was unrealistic) and actually finish something! :P

This is my first published PICO-8 cart but by no means my first attempt.
I am not really an artist and definitely not a musician so appologies if these are not the best. (You can mute just the music from the pause menu)

I really enjoyed the process of making this and thought I would share it. It is in a finished state but it may need some difficulty tweaking at some point.

I would like to give credit to:

  • nerdyteachers.com for showing me how to do screen shake. Found here
  • pixelbytes for the thick print code. Found here

I know I could have figured these things out by myself but it was nice that there were examples there when I searched for them.

Thank you to:

  • Zep - for the PICO-8
  • The community - for being an inspiration
  • Everyone who has been patient with my crazy ideas and overly ambitious (and unfinished) projects

Enjoy!

P#78542 2020-06-26 16:18 ( Edited 2020-06-26 16:57)

Cart #jufohibzu-2 | 2020-06-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

This is a basic, and not very efficient benchmarking/profiling cart.

It can handle simple nesting and repeated calls for a given label, averaging the results.

Usage

Begin and end profiling:

bm("Label")
-- code
bm()

Call at the beginning of update to clear stored data:

bm:reset()

Enable or disable benchmarking:

bm:toggle()

Show benchmarking results when enabled:

bm:draw()
P#78528 2020-06-26 05:28 ( Edited 2020-06-26 20:39)

As stated in the title, you can now use up to 32 colors at the same time in pico-8 now.

The feature was revealed by Zep in this thread: https://www.lexaloffle.com/bbs/?tid=38555

This makes all the suggestions I gave in that thread possible and more.

You can't simply use all colors all over the screen though. You have 2 screen palettes and you basically have to select which palette you will use on each drawn line on the screen. In the gif above, the screen is divided into 2 halves, each with its own palette.

Palette Scanlines

Here is the code I used for both screen palettes:

pal((
{
[0]=128+9,9,1,128+12,
13,12,6,7,
8+(curr_shield==6 and 128 or 0),2,128+10,128+11,
128+15,10,4,15}),1)

--enable 2nd screen palette
poke(0x5f2c,0x40)
--values 0x10 and 0x30 to 0x3f change the efffect
poke(0x5f5f,0x10)
--new colors on the affected line
for i=0,15 do
 poke(0x5f60+i,({[0]=2,0x8d,1,0x81,0x8d,0x8c,0x86,0x87,0x88,0x81,3,0x83,0x86,0x8a,0x82,0x87})[i])
end
--0x5f70 to 0x5f7f are the 16 sections of the screen
--0xff is the bitfield of which of the 16 line of the section are affected
for i=9,15 do
 poke(0x5f70+i,0xff)
end

The first pal() is to set the game's screen palette. Nothing new here.

poke(0x5f2c,0x40) enables the 2nd palette. This is the same address that changes screen modes (rotated, stretched, mirrored). You can add these effects as usual, so 0xc5 (0x40+133) will rotate the screen and enable the 2nd palette. See the wiki for all effects.

Pokes 0x5f60 to 0x5f6f is where the 2nd screen palette is stored.

The last poke is a bit more complicated: each address from 0x5f70 to 0x5f7f is a section of the screen. 0x5f70 is the first 8 lines, 0x5f71 is the next 8, all the way to the bottom, 0x5f7f. The value you insert in the address is a Whitfield for the 8 lines of that section. 0b1 will affect the first line, 0b11 will affect the fist two lines, 0b1010101 will intercalate the lines between the two palettes, and 0b11111111 (or 0xff) will change all lines in the section.

With this, you can select either palette for all lines on the screen. But what if you want to use columns instead of horizontal lines? Like mentioned before poke(0x5f2c,0xc5) will both rotate the screen and enable the 2nd palette. If you rotate the sprites to compensate the screen rotation you can have something like this:

Each character has their own palette!

CRT effect

Gradient Fill

If you poke(0x5f5f,n) with values between 0x30 and 0x3f, you'll have a different effect. The color corresponding to the last digit of the address will be swapped for a gradient of colors. Each of the 16 sections will be swapped for a different color (pokes 0x5f60 to 0x5f6f). An example will make it clearer:

Here the black background of the game was swapped for a gradient of the 16 basic colors, using the code below:

poke(0x5f2c,0x40)
poke(0x5f5f,0x30)
for i=0,15 do
 poke(0x5f60+i,i+128)
end

So what does the 0x5f70 address do in this mode? Now each bit determines if that particular line will use the corresponding 0x5f6n color or 0x5f6n+1. Adding the code below will produce the following effect:

for i=0,15 do
 poke(0x5f70+i,0xff)
end

This might seem a bit unimpressive at first, but remember that you are free to use any of the 32 colors in this gradient, not only the ones you're using currently on the screen. This can be used to add colors to a platformer background or background effects in a shmup for instance. Here is a quick example:

If you look closely the game uses all 15 colors in the foreground and UI except for color #12 (light blue). The light blue is used for the gradient, using the regular colors 0, 1, 12, 6 and 7 and also 0x81 and 0x8c from the alternate palette (18 total colors). Here's another example using 21 colors:

Here is the code for this gradient. Just swap the colors for whatever you like :)

poke(0x5f2c,0x40)
--swap 0x3c for 0x3n where n is the color that will be swapped for the gradient
poke(0x5f5f,0x3c)
for i=0,15 do
 --put the gradient colors in the table below:
 poke(0x5f60+i,({[0]=0x82,0x82,0x84,0x84,4,4,0x89,0x89,0x8e,0x8e,0x8f,0x8f,15,15,0x87,0x87})[i])
end
for i=0,15 do
 poke(0x5f70+i,0xaa)
end

That's all I have for now. Have fun!

P#78518 2020-06-25 22:17 ( Edited 2020-06-28 23:31)

Last week I started working on a remake of Julian Gollop's 1985 masterpiece: Chaos Battle of Wizards. It is a game I have tried and failed to make many times, but maybe this time will be the charm... I'm not planning to make a perfect clone of the original game, rather I will take heavy inspiration from it while trying to give it my own spin.

For that reason, I have mostly stayed away from looking at the original - I'm trying to do this mostly from what I remember, which should help make it a bit different from the original.

This cart is not playable yet, because the biggest challenge will be fitting enough sprites into such a confined space while keeping all of the summoned monsters recognizable. So I'm going to try making all the art before I start getting into the code. So have a look at the first few sprites below and see if you can figure out what each of these is supposed to be. Please give me a shout if there's anything that is unclear or ugly!

Cart #mayhem-1 | 2020-07-09 | Code ▽ | Embed ▽ | No License

Changes:

  • 2020/07/09:
    • Crocodile
    • Gorilla
    • Lion
    • Zombie
    • Wraith
    • Ghost
    • Vampire
    • Horse
    • Pegasus
    • Unicorn
    • Dragon
P#78516 2020-06-25 21:30 ( Edited 2020-07-09 21:02)

[80x8]

I'm working on a new game and trying some nice advance platform techniques, currently it has support for.

I don't think the codes is good enough to make it work on any game but maybe it helps someone :) would also love some feedback if someone has any.

🐸🐸🐸🐸🐸🐸

You can toggle the debug info with X

Cart #frogtris-0 | 2020-06-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

General resources dump

Full Celeste Twitter thread
AABB + Swept collisions on GBC
Kyle Pulver nudge Assistance
Kyle Pulver coyote jumping
Rodrigo Monteiro The Guide to implementing 2D platformers
Sonic collisions
Yoann Pignole Platformer controls
Advance Platform movemnt
Jumping Graphs For Platformer Games
N++ Collision Detection and Response

Pico8 Specific resources

Nerdy Teachers Platformer setup
Advanced Micro Platformer - Starter Kit

P#78512 2020-06-25 19:38 ( Edited 2020-07-07 20:02)

Cart #dancedance-4 | 2020-06-25 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

First coding I did using PICO-8 trying to get used to it

and I made a character edit/select screen, lets you change colour of clothes/skin

P#78510 2020-06-25 19:32 ( Edited 2020-06-25 20:13)

Hello! I am setting up a Pico 8 Console in my shed, but can't get the screen scaling just right. This is running on a raspberry pi, and otherwise seems to work great.

However, Pico 8 runs either much too small, or just a fraction too big.

These are the settings I am using in config.txt.

Is anyone able to help?

// :: Video Settings

window_size 768 576 // window width, height
screen_size 768 576 // screen width, height (stretched to window) 
pixel_perfect 0

// :: Window Settings

windowed 1 // 1 to start up in windowed mode
window_position -1 -1 // x and y position of window (-1, -1 to let the window manager decide)
frameless 1 // 1 to use a window with no frame
fullscreen_method 0 // 0 maximized window (linux)  1 borderless desktop-sized window  2 fullscreen
P#78497 2020-06-25 12:21

Hello.

I am running Pico-8 using this bat file, so that it stays portable, and all files, settings and carts are kept in one folder (I really don't like how Pico-8 puts stuff in a random folder that Windows people usually never use).

start pico8.exe -music_volume 0 -home . -root_path . -desktop_path . %*

I also changed -music_volume to 0 in the config.txt file.

However, every time I run Pico-8, the setting in the config file gets reverted back to 256 and the music volume always stays on.

Also, every time I run Pico-8, I maximize the window (not full screen), but the next time I run it, it always starts as a small window, not a maximized window.

What am I doing wrong?

P#78489 2020-06-25 10:44

Hi

I found a Pico-8 cart on Itchio (https://bati.itch.io/super-pico-fighter) and I want to take a look at the code to see how the block matching logic works.

Unfortunately I wasn't able to see a download link and I couldn't find it listed here in the Lexaloffle BBS.

Is there a way I can download it so I can learn from it?

Thank you.

P#78488 2020-06-25 09:58

The first paragraphs are just some opening thoughts to contextualize where I'm coming from with this idea. If you are not interested in that, skip to [Suggestion].

Context

When the 2nd palette was first discovered, increasing the total number of colors on the screen has been suggested a number of times. That in itself is a pretty weak idea: bumping up pico-8's limitations is against its whole purpose of self-imposed limitations. If you want more colors, just use any other platform. End of story.

But recently, with the 0.2.0x versions, a lot of new features have been added that expand what pico-8 is capable of: better code compression, tline, the upcoming oval(), new chars (kana, puny). Tline in particular changes the whole feel of the carts that use it, with the possibility of mode7, rotation, map lighting, etc. While those effects were previously possible, the games that had them would pay a high cost in CPU and tokens.

Ever since the 2nd palette came, I had some ideas of how the color limit could be increased without going against pico-8's design principles. From these ideas, I selected my favorite and arguably the one that fits pico-8 the best. With pico-8 going beta and possibly its core being set, this might be my last opportunity of sharing it, so here it is:

Suggestion

  • Change the [p] parameter in pal(tbl,[p]) to a integer value between 0 and 128. The [p] value is the first scanline that uses the new palette;

  • This would effectively increase the possible uses of the function from 2 (draw palette and screen palette) to 3 (draw palette, screen palette, and mid-screen palette);

  • If [p] is 0, you change the draw palette as usual. Likewise if [p] is 1, the first line is changed to the new palette, all the way to the last line. No changes here. If [p] is above 1 it means the first scanline of this palette is not at the top of the screen, so it will change the screen palette from that line onwards;

  • Using [p>1] more than once per flip will replace the last mid-screen palette. In the code below, only the [64] value would take effect:
function _draw()
 pal({129,130,131},32) --changes the mid-screen palette for y>=32

 pal({132,2,0},64) --overwrites the pal() above so only this one takes effect when the screen is drawn
end

Uses

In alignment with pico-8's philosophy, this would allow new things to be done, but also create new challenges to overcome and breed creativity through its limitations. Here are some examples:

Water palette

Pal-swap the lower half for some water effects, like in some 16-bit games. It could also be used for water reflection.

Split-Screen

In a game with split-screen, changing the screen palette would affect the other player's half-screen. This new feature would prevent that.

Fighting game character select/VS screen

Poke(0x5f2c,0x85) rotates the screen, so instead of top/down palettes, it's left/right. With that, you can have nice 15-color palettes for each character in a VS screen, with the black background hiding the transition between palettes. More juice could be added to each side with their respective palettes (character's names, country flags or whatever else).

UI

Kind of a crude example, since this game was not intended for that, but you could have some different colors for UI if it has a more clear separation from the game area, like it's common in RTSs and some point-and-click games (the red arrow indicates the transition line).

Custom Tools

In my custom tool, Painto-8, the entire screen changes when you open the palette selection. This feature could help to circumvent that, making it less jarring.

Mode 7

In games that use mode7-like effects, you can have 1 palette above the horizon (for the sky and UI) and another below (ground, characters and objects).

Anyways, you get the idea. It really creates a new layer of cool things to explore while mostly keeping the same restrictions. I think it fits pico-8 well... Who knows :)

P#78471 2020-06-24 23:45

hi!

how do i setup a permanent storage?

0.2.0i_windows, fresh install from itch.io, "install_demos" just quits PICO-8 completely. plus there is no pico-8 related stuff in "AppData/Roaming" (could it be because of the cyrillic windows username?)

thanks,
Dima

P#78470 2020-06-24 19:30

A few days ago someone on my discord server asked me how to configure keys in an exported cart and I didn't figure out how to do it, nor did I find any information about it anywhere...

So I assume there's no way to do it right now...?

Just letting the player access the Keyconfig screen from the controls screen would be great.

And saving the config after each session :)

I think it's something that can easily affect user reviews in external sites, Itch.io, Kongregate, and so on, and also help with accessibility.

P#78469 2020-06-24 18:20

Here are two general-purpose example of my sprite rotation function using tline, one for square sprites (112 tokens), one for rectangular ones(154)

Cart #tline_sprite_rotation-1 | 2020-06-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

draw_rotated_rect(x,y,sw_rot,mx,my,w,h)

It always draw a screen-oriented rectangular area, (centered at x,y) large enough to contain the rotated tiles (from mx,my to mx+w,my+h), and calculates the rotated (sw_rot 0 to 1) tline coordinates and deltas.

The catch is that you need a "clearance-space" around the map part to be rotated, matching the largest side of the sprite or you get some additional map tiles drawn as well, visible in pink in the example. But you can just prepare one rotating area and just swap tiles with mset()

The rectangular one could be improved by recalculating the bounding area at each rotation at the cost of additional tokens.

this line just draw a bounding box to show the exact draw area and is not necessary outside of this example:

rect(x-delta_px,y-delta_px,x+delta_px,y+delta_px,5)

Hopefully someone will improve this further.

P#78451 2020-06-24 05:59

Cart #zonday-0 | 2020-06-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

i don't really know why i made this

it was based off some bait and switch site that had chocolate rain as one of the options

mainly wanted to practice making/porting music to this thing

P#78455 2020-06-24 05:56

Today was the first day I did a videogame with my son.

He's 3 years old. He helped me pick all the colors and with design decision, like what kind of dinosaur to include and what he would be doing.

The game itself is literally 6 if blocks, and I wrote it pretty quickly, starting from api.pb . It still felt like an eternity to my toddler! He could see progress while I was drawing the dino and the flowers, but the programming part was meaningless to him. He was vociferously demanding progress. A true client. I had to cut many features. Bounds checking, for example, only works partially. It became a feature ("ooooh where did the dinosaur go?")

CONTROLS: Move with arrows, water flowers with Z.

Cleaned up before publishing.

Cart #dinowateringflowers-0 | 2020-06-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

P#78442 2020-06-23 20:49 ( Edited 2020-06-23 21:08)

Run and jump your way to the magical ice cream. :)

My very first PICO-8 game, but not my first time trying game development. I made it over a three day weekend, maybe eight hours? I used the "collide.p8" demo as a reference.

Once you make it to the ice cream you've pretty much seen the entire game.

Cart #kpugefn-1 | 2020-06-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

P#78441 2020-06-23 20:44
View Older Posts
Follow Lexaloffle:        
Generated 2020-07-10 06:36 | 0.131s | 4194k | Q:160