Log In  
Follow
sparr
[ :: Read More :: ]

stat(90) and neighbors give us wall clock time, which is useful for logging. However, at more than 1fps we'll get the same wall clock time on consecutive ticks/frames. It would be nice to be able to get milliseconds as well to disambiguate high frequency logs, without needing to track a frame counter in my game code.

P#128620 2023-04-16 15:08

[ :: Read More :: ]

Cart #fill_pattern_demo-5 | 2020-02-19 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
10

Demonstrating the built-in fill patterns in 0.1.12d, which are implemented as numeric constants in variables whose names are the glyph characters.

P#73223 2020-02-19 08:50 ( Edited 2020-02-19 08:59)

[ :: Read More :: ]

Cart #gunnersmates-0 | 2020-02-16 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

This is a rough draft of my idea for https://itch.io/jam/weekly-game-jam-136 "Single Player Co-Op". You are a turret gunner that can only shoot in one direction, and you only have about 16 seconds (no visible timer yet) to shoot all the targets circling around. Unfortunately that's not enough time. So then you start over, pointing a different direction, helping out your previous iteration, but that's still not enough. So you do it a third time, and now there are three of you. Eventually there are enough of you working together to kill all the enemies within the time limit... and nothing happens because I didn't include an ending yet.

P#73142 2020-02-16 00:12

[ :: Read More :: ]

Cart #tweetbubblewrap-1 | 2020-02-15 | Code ▽ | Embed ▽ | No License
5

My first tweetcart with sound. Pop all the bubble wrap, then start again!

poke(24365,1)s=stat::r::b={}::m::
flip()cls()for p=0,63 do(b[p]and circ or circfill)(p%8*16+8,flr(p/8)*16+8,7,p%15+1)end
if(s(34)>0 and not b[p])sfx(0)b[p]=1
if(#b>62)goto r
x=s(32)y=s(33)pset(x,y,6)p=flr(y/16)*8+flr(x/16)goto m
__sfx__
000400000e6453667528655126350b624
P#73119 2020-02-15 10:02 ( Edited 2020-02-15 10:05)

[ :: Read More :: ]
------------------------------------------------------------------------
-- takes a string describing a map and the width of the map
-- other parameters reimplement map()
-- example "0123456789abcdef",4 represents this 4x2 map:
-- [[0x01,0x23,0x45,0x67],[0x89,0xab,0xcd,0xef]]
function mapstring(mapstr, mapw, celx, cely, sx, sy, celw, celh, layer)
 -- remove[] to save tokens by making parameters mandatory
 ms, celx, cely, sx, sy, celw, celh, layer =
 ms or "", celx or 0, cely or 0, sx or 0, sy or 0, celw or 1, celh or 1, layer or 0
 for y=cely, cely+celh-1 do
  for x=celx, celx+celw-1 do
   local sprnum = tonum("0x"..sub(mapstr,(y*mapw+x)*2+1,(y*mapw+x)*2+2))
   if sprnum>0 and band(layer, fget(sprnum))==layer then
    spr(sprnum, sx+(x-celx)*8, sy+(y-cely)*8)
   end
  end
 end
end

This might be useful for games that define a large number of small maps (like metroid or zelda screens).

P#73060 2020-02-13 11:31 ( Edited 2020-02-13 19:28)

[ :: Read More :: ]

This function uses bresenham's algorithm mirrored to the 8 octants, filtered by angle for the desired arc angles. It's so slow as to be useless; there are much better arc functions on the BBS already. I'm posting it for posterity and future reference, and because it inspired me to come up with a handy octant-range asin() approximation that might actually be useful

-- approximation of asin(d) for 0<=d<=.7071
-- exact at d==0, d==sin(1/16), d==sin(1/8)
-- max error .0021 at d==sin(3/32) in given range
-- error within that max beyond bounds up to d==sin(.137)
function delta2angle(d)
 return d * 0x.29cf + (d > 0x.61f8 and (d - 0x.61f8) * 0x.0785 or 0)
end

function arc(x, y, r, a1, a2, ...)
 a1 %= 1
 a2 %= 1
 if (a1 == a2) pset(x + r * cos(a1), y - r * sin(a1), ...) return
 a2 = a2 + (a1 > a2 and 1 or 0) -- ensure a2>a1
 dx, dy = r, 0
 while dy <= dx do
  a = delta2angle(dy / r)
  for flip_x = -1, 1, 2 do
   for flip_y = -1, 1, 2 do
    for diag_mirror = 1, 2 do
     local ta = flip_x < 0 and .5 - a or a
     ta = flip_y<0 and -ta or ta
     ta = diag_mirror>1 and (flr(ta * 4) + 1) / 4 - ta % 0.25 or ta
     ta = ta == .5 + flip_y * .25 and .5 - flip_y * .25 or ta % 1
     if (ta + 1 - a1) % 1 < a2 - a1 then
      local flips = {flip_x, flip_y}
      local d = {dx * flips[diag_mirror], dy * flips[3 - diag_mirror]}
      pset(x + d[diag_mirror], y + d[3 - diag_mirror], ...)
     end
    end
   end
  end
  dy += 1
  if (dy * dy + dx * dx > (r + .5) * (r + .5)) dx = dx - 1
 end
end
P#73025 2020-02-12 16:59

[ :: Read More :: ]
 x,y,w,h=64-10.75,64-10.25,20.5,20.5
 rectfill(x,y,x+w-1,y+h-1,8)
 clip(x,y,w,h)
 rectfill(x,y,x+w-1,y+h-1,11)
 circ(64,64,12,12)

Note that on the top and left the circle extends to the edge of the rect, as is expected since the rect was drawn to match the impending clip region. Note the extra row on the bottom, inside the original rectfill, outside the clipping rectangle.

I think this is a bug. At the very least, it's a place where the documentation needs to be clarified.

(the circle being off center is irrelevant)

P#73017 2020-02-12 14:04 ( Edited 2020-02-12 14:27)

[ :: Read More :: ]

a snippet at the end of a line renders fine: [this is code]

however, a snippet in the middle of a line never terminates: [this is code] [this is not code]

P#72823 2020-02-06 19:57

[ :: Read More :: ]

Cart #picochem-6 | 2021-01-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Playable work in progress demake I've been working on, first for a week last January, now for a week again in the hopes of getting it playable for https://itch.io/jam/zachlike-jam

The original game is http://www.zachtronics.com/spacechem/ and I highly recommend every game they have produced.

Controls: arrows move the cursor. X to open a dialog to create/replace/delete instructions and arrows, arrows to move THAT cursor, X to confirm or O to cancel, optionally then arrows to set the direction/settings of the new instruction. O to open a dialog to run/pause/reset the simulation, or to grab and drop the sense and bond targets, or to change levels.

What works here:
arrows
start (1)
in (α/β)
out (ψ/ω)
grab/drop (magnet icon, minus one of the tips for just-grab and just-drop)
rotate (curvy arrow icons)
sync (pause icon)
bond and unbond ("O-O" and "O O" icons)
bond/unbond targets
sense instruction (?) and targets
flipflop (Y)
output validity checking (99%)
collision between atoms
scoring and victory check

What's implemented but not demonstrated here:
full periodic table, all 113 elements with symbols and names and connection limits
names and abbreviations for the molecules

What's missing:
title screen (might forego)
menu screen (might forego)
more levels/puzzles
unlocking instructions based on progression
the rest of the instruction types (fuse, split, swap)
the rest of the target types (fusion, fission, quantum)
saving
score tracking

I am seeking feedback on the iconography and interface in particular.

P#72754 2020-02-05 06:20 ( Edited 2021-01-21 19:04)

[ :: Read More :: ]

When drawing in the sprite editor, left click draws and right click picks up the color under the cursor (like the eye dropper in other image editing tools).
When using the bucket fill tool, left click fills and right click... fills. It would be convenient and consistent if right click was still an eye dropper in this scenario.

P#72594 2020-02-02 02:58

[ :: Read More :: ]

It would be very handy if the built in tostr() was able to call the __tostring() metamethod for tables that have it defined. This is easy enough to add in our own code, but feels like it should be default behavior, similar to normal Lua.

P#72548 2020-01-31 23:21

[ :: Read More :: ]

-32768 and 1 are both perfectly representable in the 16.16 fixed format, as 0x8000.0000 and 0x0001.0000. As far as I can see, this division should be perfect with no floating point shenanigans.

However, 0x8000.0000/0x0001.0000==0x8000.0001

which is throwing a wrench into some code I'm writing.

Other nearby operations work fine, such as

0x8000/2

and

0x7fff.ffff/1

and

0x8000.0001/1

Then there's another group of operations that seem to be technically misbehaving but in a possibly desirable way.

0x4000/0x0.8 0x2000/0x0.4 ... 0x1/0x0.0001

should technically all overflow to 0x8000 (-32768) but they actually evaluate to 0x7fff.ffff which renders as 32768 because it's higher than 32767.9999. Maybe this is intentional, and maybe it's helpful, but I mention it here because it might also be related.

PS: there are markdown rendering bugs affecting this post which is why it's weirdly formatted

P#72485 2020-01-31 01:28 ( Edited 2020-01-31 05:49)

[ :: Read More :: ]

It would be helpful if calling color() to change the default color would return the previously default color. I am currently using a snippet like this to restore a previous default color:

 t=band(peek(24357),15)
 color(c)
 blah blah
 color(t)
P#72338 2020-01-28 06:39

[ :: Read More :: ]

Cart #paintball_logic-1 | 2020-01-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

This is my first attempt at making a PICO 8 game. It is inspired by Zachtronics puzzle/programming games. The theme here is that a given series of balls will enter the grid from a queue, and you need to output the required series.

This is the second version, which might actually qualify as a real puzzle game now, with a few different mechanics and half a dozen "puzzles". I hope to continue development of features and more real puzzles!

P#72125 2020-01-20 06:21 ( Edited 2020-01-21 02:14)

Follow Lexaloffle:          
Generated 2024-03-29 04:40:27 | 0.081s | Q:37