How to implement a simple lean mechanic in pulp?

Hey all! Just created a new account and very much looking forward to interacting with you all.

I've had an interest in making games for a while, but nothing has stuck until I got my playdate and I'm feeling really inspired to try this time around. Pulp seems like just the right level of complexity to get started.

I'm making a prototype in which the player is walking on a tightrope. As such. They can only move up and down (blocked by wall tiles on either side), however I'd like to implement a mechanic in which the player can lean left and right to dodge hazards, etc.

Thus far, I've created transparent tiles in a column on either side that the player can move into, but what I want to see is that the player "lean" into the space when the button is held, and then "lean back" onto the tightrope when it is released.

I'm having a hard time getting my head around PulpScript as a noob. I suspect this might lie in the event.dx variable, but beyond that I'm a little clueless. If anyone could help me here I'd really appreciate it!

Tysm,
Gaelien.

It's hard to get your player to do stuff in more than their current tile, but I think Ive seen some folks here do it.

If I were trying this, I'd just animate them, but that's probably because I dont know the answer.

Good luck

Welcome! Pulp is a great place to start with making games for the Playdate - just start simple and build your way up!

Held buttons aren't really a thing in Pulp (afaik it's possible to code in with some hackery for the direction buttons but impossible with the A and B buttons). For your first project I would rethink your design to avoid this altogether so you don't get bogged down in awkward code and pushing up against the edges of pulpscript. Perhaps leaning could be done with the crank instead? That might be fun as a way to "balance" on the tightrope!

Having a 3-tile wide area that the player can move in isn't a bad idea though, you could do something as simple as swap the player tile to look like it is leaning in the right direction depending on the player's y coordinate.

Keep us updated with your progress!