Log In  
Follow
sparr
Follow

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

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)

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

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

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

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)

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

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

 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)

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

Cart #picochem-0 | 2020-02-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

First interactive demo of a demake I've been working on, off and on for the last week or so.

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 of the new instruction.

What works here:
arrows
start ("1")
in ("a" or "b")
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

What's implemented but not demonstrated here:
full periodic table, all 113 elements with symbols and connection limits
input collision detection

What's missing:
title screen
levels/puzzles
menu screen
collision between atoms
checking outputs for validity
control of the simulation (start, stop, reset, step, etc)
the rest of the instruction types (out, sense, flipflop, fuse, split, swap)
the rest of the target types (sense, fusion, fission, quantum)
a way to move targets
display of inputs and outputs
scoring
saving

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

I do not currently need crash reports; I already know of at least a dozen edge cases I haven't coded for yet.

P#72754 2020-02-05 06:20 ( Edited 2020-02-05 06:21)

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

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

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

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

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

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 2020-07-13 08:16 | 0.108s | 2097k | Q:98