Log In  
Follow
camp39
the true guide to objects, prototypes and metatables
by
[ :: Read More :: ]

little help?
A sprite shakes if a certain condition is met and function called. I'd like to play a sound effect while it shakes. But I cant seem to make it play the whole sound effect because it starts over with each update and buzzes rather than plays. I can get the sound effect, or I can get the animation, but cant seem to make them both happen at the same time.
I've tried many different variations and schemes, but here is one example:

function _init()
 correct = nil
 tics    = 30
end

function _update()
 if (correct == false) shake()
end

function _draw()
 draw_stuff()
end

function shake()
 sfx(0)
 tics -= 1
 if tics > 0 then
  mysprite.x = mysprite.x + cos(t()/.1) --makes it shake back and forth
 else
  correct = nil
  tics    = 30
 end
end

I can see why it doesn't work; because it is calling the sfx(0) again and starting over every time shake() is called. But what is the right way of thinking about playing the sound along with an animation? I read about coroutines, but am not sure if that is actually needed for something this basic. I'd also like to just be able to call the function whenever I want and not bother checking in _update() every frame.
I'll be grateful for any good example, tips, explanation or pointing in the right direction. Thank you.

P#151296 2024-07-14 08:15

[ :: Read More :: ]

Cart #stafford_gambit-1 | 2024-06-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Variations: The Stafford Gambit

Credits

  • These variations come from the Eric Rosen youtube channel.
    (watch the link while practicing with this cart for maximum understanding)

  • Big thank you to @Heracleum for kindly going through one of my previous variation carts and teaching me how to properly make a data table. Its made more variations possible.

About

The Stafford Gambit is an objectively bad opening for black. But white has to play accurately which is very hard to do, giving lots of attacking chances, pins, traps, and nasty mates. Natural moves for white lead to certain doom. If you learn these 20 variations inside and out you will confuse many opponents and have a blast doing it. If your opponent really knows what they are doing, you may be in serious trouble!

Features

  • starting position is on move 3.Nxe5 for less repetition
  • computer moves faster than previous, painfully slow variation carts
  • hint button
  • random variation selection
  • menu navigation
  • stockfish evaluation at end of each variation

Controls

❎ select/de-select piece and move-to square
🅾️ hold down during black's move to show a hint

P#150338 2024-06-24 06:20

[ :: Read More :: ]

Cart #variations_vienna-4 | 2024-05-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Variations: The Vienna

Description

16 variations of the Vienna opening played as white. These lines are chosen to be fun, for their attacking chances and dynamic play. They include common mistakes by black and how to punish them as well as how to respond to good play from your opponent. Practicing with this cartridge will give any player a good start to creating big problems for black with the Vienna!

Features

While none of white's moves are dubious, they are not necessarily the top engine recommendations. Because there is no 'right' move, a hint can be requested (see Controls). After completing a variation, the Stockfish evaluation is given. The player then has the options to either repeat the completed variation, move on to the next, or have the computer select a variation at random. The pause menu gives similar options but can be accessed at any time allowing the player to navigate to a specific variation or move to a new, random variation.

Controls

❎ select/de-select piece and move-to square
🅾️ hold down during white's move to show a hint

P#148751 2024-05-21 02:25 ( Edited 2024-05-26 04:13)

[ :: Read More :: ]
a = {x=10, y=25}

b = a

b.x = 99

print(a.x)

This prints 99 but I assumed it would print 10.
I wrote code with a start table. Then I set a position table equal to the start table. I was hoping to update the position table but reset the position back to the start point at any time I wanted. I tested this out in php to make sure I wasn't crazy and it worked like I expected. I tried it out in strict Lua but it gave the result above. Why does Lua change the a table when I only changed the b? How do I deal with this?

P#147872 2024-05-03 23:49

[ :: Read More :: ]

In pico-8, when I want to reuse a sprite sheet for a new cart, I would just
copy/paste all the gfx and map data at the end of the file. It's not so simple
in Picotron.

How do I start a new cart in Picotron with an existing sprite sheet and map?

P#147524 2024-04-29 02:42

[ :: Read More :: ]

Mate-in-2 Volume 2. 33 more puzzles. White to move.

Cart #matein2vol2-0 | 2024-04-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

P#147158 2024-04-22 23:58

[ :: Read More :: ]

Cart #matein2volume1-0 | 2024-03-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

33 mate-in-2 puzzles. White to move. Will release more volumes.

P#144867 2024-03-28 16:50 ( Edited 2024-03-28 17:17)