Playing with pulp
Tags: gamedev, beginners, playdate, pulp
Published: 2023-01-09 18:26:39

## Baby steps
- Go to [the homepage](https://play.date/pulp/)
- Read the three short blurbs
- Get excited to try this awesomely accessible game-making tool
- Click the [Try it](https://play.date/signin/?next=/pulp/) button
- Sign in

See this:
![pulp default screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x66y9pw7vuta30cwwlzn.png)

## Start analyzing what I see
![pulp screen marked up](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zikdpqi46wpxiudzjyxv.jpg)

Before pressing anything, I feel like I understand all but one small section of the screen's controls.

Among the many views, I'm intrigued by the one labeled `Room`.

Do I want to keep clicking around? Or click on the first link under Help & Docs to get a lesson in pulp?

I gotta play around, right?

## Playing around
### Export
- I pressed `Export` in the left-hand menu
- To my surprise, it downloaded a `JSON` file. I know how to read that!
- I opened it in my text editor and saw a ton of `1`s and `0`s along with key-value pairs
- I assume the `1`s and `0`s indicate whether certain pixels are black or white

![Exported game JSON file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2f89ao0h23h0r23x167.png)

### Font
- I pressed `Font` to go to that view
- I saw a full character set
- And several icon buttons with helpful tooltips
- Clicking on characters shows them as highlighted and selects that character to edit
- Editing is as simple as toggling a square between white and black
- The character immediately updates in the other two panels
- Seems easy enough to design my own font!

![Changing the letter E](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/80sjtw6bnurro9z5yihg.png)

### ...Playing the game
- I clicked through the other views
- `Room` was a bit intimidating
- `Song` and `Sound` seem fun...when I want to consider that sort of thing
- `Script` is the code for the game. There are only three files. One is empty. The other two contain very little code. And it is all very understandable.

![A script in the game](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kh9hmzyyhtu42bxbizlq.png)

- I was curious where I might see these text prompts in the game
- So I clicked `Play`!
- And used my arrow keys to control the player, moving around the stage to pick up floppy disks

![Playing the game](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ivhk6qz2hlad6k03z4xj.png)

### Back to the `Room`
- After playing the game, I messed with some controls in the `Script` view
- The script for the game had a button that linked to the `Game` view
- The script for the computer had a button that linked to the `Room` view

Clicking it brought me to this intimidating view:
![Editing a room](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6bdn3eabxtwe7gy4wrsp.png)

Well, intimidating at first.

Wonderfully, it seems this view is very self-describing:
- A stage showcasing the current room - I can edit it directly by drawing
- An area where I can manage `tiles` pertaining to any of several `layers` - these are the objects in the game, it seems
- An area where I can edit a tile's artwork and animations
- An area where I can edit a tile's behavior

This is feeling less scary each minute I spend reading labels! Phew!

### Adding and deleting/re-painting
- With the `Player` layer selected, I clicked on the stage
- It removed the player and placed him at the spot I clicked!
- Cool! Will this happen for other game objects, too?
- With either the `Sprites` or `Items` selected, I clicked on the stage
- It added the sprite without removing any
- Great, but how do I now remove game objects from the stage?
- There doesn't appear to be any `Delete` button
- However, I can replace the contents of any tile with `World` - either black or white
- Viola! `Painting` a tile with black or white removes any `Sprites` that occupied that tile
- Strangely, in cases where sprites occupied adjacent tiles, painting one replaced all adjacent tiles with that color
- I better be careful of that in the future

### Creating and adding a tile
I wonder how easy it'll be.

- Click the `+` in the Tile section
- Give it a name - `bug` in my case
- Color in some squares to make the tile have some form
- Click the stage to add an instance of the tile to the room
- For `Behavior` select `Say` and enter some text
- Play the game and see what all that just did

![Seeing my bug say words](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j5kdmwj18uuk6dhczn59.png)

That was really easy!

### Giving my bugs behavior
Instead of just saying something, I want my bugs to change the game's state.

- When I toggle the Behavior from `Says` to `PulpScript` I can enter code
- I move to `Script` view for a larger code editor
- Thankfully, I now have an `interact` script unique to my bug tile

I wrote this code to simulate the bug eating all the collected floppy disks, then saying so:
```
on interact do
  if disks==4 then
    say "I ate all {disks} of your floppy disks."
    disks = 0
  end
end
```

It worked as expected:
![Bugs working correctly](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w0phbpgznr0i8b61t5it.png)

## Ending this play session
- Pulp is a delight to mess with
- It was a bit intimidating at first, but now feels very familiar and comfortable
- It all feels like painting, really

I want to do a few things next:
- Download the `PDX` file to my Playdate device to see the launch card and play the game for real
- Read the Pulp and PulpScript docs to review what I saw and learn how to add more robust behavior sprites and items in the game

May the fun continue!