Tile upon the player

Hi there, I'm new here, nice too meet you all ! =)
I'm not a programmer at all but I try to make simple games for my daughter and pulp is really a great too do that !
I'm doing good for now but I wonder if there is a way to make the player pass under a tile ?
In order to make the player walk behind a tree for exemple .

This will need a bit of scripting, and I hope you're ok with that. The way I'd do this is to hide the player when they're on that tile. I'm attaching a simple example.

I have a tree made up of two tiles, tree and tree trunk. They're both Items, meaning they can be stepped on and scripted. The tree item has a script saying, when you collect me (step on me), set the variable playerShouldHide to 1. The tree trunk tile is told to mimic exactly what tree does, since we want this behavior to apply to both of them.

The Player script then has two events:

update which happens whenever the player moves. This resets playerShouldHide to 0 so that we don't hide the player when stepping outside of the above two tiles. (The collect event above happens after this update event.)

draw says, if the player should hide… then hide the player :slight_smile:

I hope that's of some help! You can get the script here:

Player Behind Tree.json.zip (2.6 KB)

3 Likes

Ho Neven, that's perfect thank you so much !!!
It works perfectly fine and easy enough to use for my level haha :grinning_face_with_smiling_eyes::ok_hand: