For literally-years now I've had this comment at the top of my Kid Radd cart, right under the label comments:
--__ext__ --pal[1]=0x243566 --pal[6]=0xc0c2e3 --pal[12]=0x576dff --pal[14]=0xff5e98 |
Although more recently, Pico-8 has become able to properly handle standard Lua multi-line comments, so that could be changed to a cleaner block with a defined ending, like this:
--[[__ext__ pal[1]=0x243566 pal[6]=0xc0c2e3 pal[12]=0x576dff pal[14]=0xff5e98 ]] |
These comments are entirely unused, waiting for some kind of extension format to come along and read metadata to make modifications to the machine before the cart runs as normal. With the theory being that the block of comments could be "cut out" of the script and run as their own, separate, "configuration script" with reasonable ease, using an extension API of some sort. In this case, the configuration script expects to be given an array named "pal" (no relation to the Pico-8 command of the same name) which is pre-populated with Pico-8's default palette, and then internally gets read back to set the screen palette before the game script even begins.
However, if such extensions [i]were
This is a small (259 token) library for finding entities close to a point.
A bucket hash (also called a spatial or grid hash) breaks up space by a grid size, and maintains a sparse table of "buckets" representing a grid location. When entity membership in these buckets is updated, you can quickly
retrieve entities near a given point.
-- usage -- create a data 'store' {size=30,prop="pos"} -- store.prop should match your entities' position property name, -- which should be a 'point' value like {x=0,y=0} -- store.size should be tuned to the max neighbor distance you'll be finding -- periodically call bstore(store, entity) to update their bucket membership -- bget(store, point) returns stored entities from a 3x3 square of buckets around -- the given point, filter these by a distance function if you need more precision -- bdel(store, entity) to remove an entity -- remember you can maintain multiple stores based on the needs of your game! |






I had posted this in the work in progress category a bit ago. I have made some improvements and feel like I am at a place with it where it should be submitted to 'carts' proper (changes include updated boss 2 death sequence and a few tweaks to general gameplay that make things run smoother and have a more polished look).
Proxima-B is a space shooter featuring:
• Two distinct shooter levels
• Two boss fights
• A fun/atmospheric soundtrack
• Two powerups: spread shot and super shot (double damage and larger bullet)
• A platforming epilogue (Which exists mostly for storyline/gag purposes (in that level you can press up for a jet-pack effect, and X to open doors).
Screenshots (I left the boses out of the screenshots, to leave a bit of surprise):




Notes on this version: The game is meant to be fairly hard and quirky. I got feedback from friends and forum members dismayed at the lack of rapid fire while moving. I gave serious thought to switching it, but found the game to be WAAAY too easy with the inclusion of true rapid fire, so it has been left as is: you can hold fire to rapid fire while not moving but there is a bit of delay for it to kick in, so doing it while moving does not work and you will have to tap it out to fire while moving. In general, I suggest going for accuracy over bullet spam. Also: let things pass you. You advance by killing, but you don't need to kill everything. I took some advice from a forum poster that suggested (thanks for the advice!) that the game over sequence be shortened: you can now hit X immediately to continue, regardless of whether or not the end game animation has completed. Finally, Proxima-B is definitely easier and more fun with a USB controller plugged in.
Have fun and enjoy the game!


I'm trying to write a function to switch negative to positive and vise-versa. I've got:
foot=3 function switch(f) f*=-1 end |
when I call switch(foot) it returns the original value but if at the command prompt I type "foot*=-1 it preforms as expected.
Thanks for any help and sorry for these remedial questions.
--
-john






Goal
Spin a web, eat bugs, earn points, and have fun!
8 Legs to Love is separated into six levels of just over two minutes each. The goal of each level is to spin an elaborate web and use it to catch bugs. Each level poses a different challenge for building and maintaining a web, and introduces new and exotic types of bugs. Complete a playthrough and work towards a personal high score! Or just have good time, there's no pressure.
Controls
Arrow keys - move
Hold Z - spin web
--> then Tap Z - place web
Bugs
Fly (blue) - the most basic of bugs, +10 points
Happyfly (pink) - a bug that's having a good day, +20 points
Beetle (red) - chews through web, +30 points










When does -1 not equal -1? When -1 started out as the string "-1", of course!
Please examine this source code closely, then run it for a surprise fixed point math bug or sommat.
(If you are visiting this thread in the future, after zep has updated the web player, refer to the cartridge label for the original output.)
(I do not know if this is a duplicate symptom of another bug that has already been fixed in 0.1.11, sorry...)
-- start with a string. local m = "-1" -- m is a string. if m == "-1" then print("m is a string -1, to start") end -- coerce m into being a number. m = m*1 -- this is one method. m = m+0 -- this is another way. m = m/1 -- i guess you could do this too, but you probably shouldn't. -- why don't you just add tonumber() already. print([[m has been coerced into a number (but there's no way to be sure)]]) if m == -1 then -- this should be true. -- it would mean m is an -- ordinary number, valued -- at -1. print("m == -1") elseif m == "-1" then -- if coercion failed, -- then *this* should be true. print('m == "-1"') elseif m < 0 then -- neither of those are true, -- but m is still < 0 somehow?? print("m < 0, but not equal to -1") print("m prints as ["..m.."]") else -- wtf is m? print("???") end print(m.." + 1 is "..(m+1)) m = flr(m) if (m == -1) print("oh *now* it's -1. thanks flr.") |


My first game, I'm a programming novice.
Catch spaghetti in your bucket, or press z to open wide. Watch out for knives.
Based off an idea by J Kantz (http://inkmo.tumblr.com/post/157810719733/inkmo-i-mightve-started-something-catch-em)

I would like to create a function that would move one point in along a circle around another, but lack the math know how.
here's what I have cobbled together from examples elsewhere and a little help, hopefully at least my intentions are clear (the inc=increment would let me fiddle with how fast p2 travels)
point1={}
point1.x=68
point1.y=78
point2={}
point2.x=57
point2.y=43
function orbit(p1, p2, inc)
distance = sqrt((p1.x-p2.x)(p1.x-p2.x) + (p1.y-p2.y)(p1.y-p2.y))
ang= atan2(p2.y, p2.x) - atan2(p1.y, p2.x)
p2.x=(p1.x + distance cos(ang+inc))
p2.y=(p1.y + distance sin(ang+inc))
end
function _update()
orbit(point1, point2, .01)
end
function _draw()
line(point1.x, point1.y, point2.x, point2.y, 7)
end
--
-john



Isola is a board game (sometimes also known as Isolation or Solitude). After my last cart I decided I wanted to try a puzzle game or some kind of game that wasn't action oriented. After doing some research I found Isola, and it seemed like I could program an ai for it pretty easily. So I did. This was my first experience programming an ai that adapts to the player's moves. My previous game was a shooter with set motion and random starting points for enemies. It was an interesting experience. I think I'd like to try more complex move trees and point systems for a cart at some point.
The ai will not likely challenge anyone for long, but it will win games against casual players and should be a mild challenge for first timers with Isola.
The rules are included in the cart. Games tend to go pretty quickly. The two player mode uses only one key set and just swaps what piece that keyset controls. I can add alternate keys if people want.
This was a quick turnaround and I was well under the token and size limits, so I have not optimized the code much at all, but it should be mostly clear what is happening for anyone that is curious.
I hope y'all enjoy the game!
[i]Update 1: I fixed a situation in which the computer opponent would cheat. The only other change I may make would be to improve the ai's play when destroying tiles...but it performs alright at present, so I may just keep it as is.



This is a small (257 token) tweening library. It allows you to tween any value over time, and can be extended
by supplying your own easing and lerping functions. It also allows callbacks, functions that are called when the tween has finished, letting you sequence animations and code.
quick start:
tween(player.position, "x", 64, 100, {e=pow(2)}) -- tween(object, prop_name, target_value, duration, options_table) -- options are -- "e" dual in+out easing fn -- "ei","eo" in,out easing fn -- "f" tween callback (takes 1 argument - the object) -- "l" lerping function, default lerp works with number values |
I know most people aren't using the "User Blogs" section of this website for random thoughts and updates style blogging. But it doesn't make much sense to me to blog about it elsewhere if I don't already have a presence somewhere doing so (which I do not). So I have decided to do the occasional blog update of my Pico-8 coding here.
--
I have more or less finished my space shooter (Proxima B. I posted v0.9 a bit ago, and have finished 0.91 but have yet to update online. It is mostly just bug fixes, and a few additional features (better boss death animation/sound for the level two boss).
I have also tried out a number of different game styles in the interim, just playing around with basic skeletons. The two that I am currently pursuing are a two player board game port and a puzzle platformer.
The puzzle platformer is adventure time themed and will involve the ice king rescuing his beloved penguins, who have become lost in the fire kingdom. At the moment I have basic physics worked out. The movement will be more like turn based movement than the standard running and jumping of a platform game. It will involve creating ice blocks to be able to walk across spaces and allowing the penguins to run up the screen (similar to a lemmings style system). At least, that is the current plan, and I have not worked out all the kinks. Some initial inspiration was taken from the NES game Fire 'N Ice. I am having trouble getting some of the physics I want to work properly (such as ice sticking to other ice and either falling or staying aloft as a group based on at least one piece being on ground or not). Here is a very early GIF:




Hello!
I have created a small aquarium in PICO8, with the idea of running it on a corner of my desktop while I work on other stuff. But I have noticed that PICO-8 runs much slower when it is not the window under focus.
Is this Working-As-Intended behavior? I can understand the reasoning, but I would like to have pico8 run at full speed even when not under focus - is there a way to do that?
Cheers!







