Log In  


Cart #pumpkin_carving-1 | 2024-10-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

A simple pumpkin carving game!

Thanks to @RealShadowCaster for all the help!

8


1

nice and simple.

Some little bugs :
sometimes parts of the inside of cuts are not blackened fully, like in the example on the left.
It's also possible to crash the game by cutting from the top left, exit the pumkin while keeping the mouse left button pressed, and reentering the pumpkin from bottom left like in the 2nd screenshot.

You could add a save image option in the pause menu.
(check menuitem and extcmd)



1

Nice game :)


@bbread,
I was peeking at the code, and saw the following comment :
"cant pass parameters into callback function, drawing_board must be a global"

I agree with both halves of the sentence, but not with the implications of the juxtaposition :
The callback is indeed just a function, so no way to pass new data to it other than through indirect ways like globals, pico memory, function calls... but it doesn't mean you need to use a global, you could use a local from the _init scope for example.
The reason a global is needed is because _init() return value(s) can't be retrieved when automatically called at startup, and you need access to the created drawing board in _draw and _update .

A concrete example, let's say we want to add a few functionalities :
"snapshot", "reload snapshot" and "save snapshot image"
In the function snapshot, you could have a local array (local snap={}) that would be filled with a copy of the drawing_board, and the functions for reloading and saving would be created in snapshot and use the snap array to do their work, as that local would stay alive after the snapshot function has returned because the created functions still have a reference to it.
Not sure I'm very clear to you, if not, I can write the code.



[Please log in to post a comment]