Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

I’m trying to riff on the script from the eye contraption to do something sort of related, but mostly to learn about Lil and Decker. (I’m brand new to both, although I have other lightweight game programming experience.)

I figured out (eventually!) that card.offset has a value in the contraption pupil but not in my other widget because the “card” of a contraption widget is its contraption (which has an offset), whereas for the other widget it’s the actual card (which doesn’t).

However, that doesn’t explain this:

image.png

If card.offset is nil, why does subtracting it change the value of the expression? (This is from the listener, but show[]ing the variables from the widget seems to reveal the same behavior.)

(+1)

Note that pointer.pos means “wherever the mouse pointer is”, so if you move the pointer (for example, to click on a previous entry in the Listener to avoid having to retype the whole thing) then you’ll get a different result.

(+1)

If nil is an operand of an arithmetic operator like subtraction it will be coerced to 0, but in this case it shouldn't make a difference.

I suspect the source of confusion here may be pointer.pos ; the fields of the pointer interface update every frame (at 60hz) to reflect the state of the pointing device, so if you moved your mouse or interacted with a touchscreen at all between evaluating those expressions you'll generally see a different value.

(+1)

Ah, heck, I was so sure I hadn’t overlooked something that simple, but retrying again more carefully I think you’re both right. Looking at the timestamp of my post, that’s what I get for troubleshooting tired. 😬 Thanks both.