Let’s get Advanced – Make a Spring

Note: this tutorial is out of date. You can use the concepts from this tutorial combined with the up-to-date tutorials listed below:


You can make some really cool things in Gamefroot’s Advanced Behavior Editor, and there are a few core blocks that you can use over and over again to make interesting things happen. Today we will focus on using message blocks to trigger other blocks.


You can use message blocks to send specific messages that activate other behavior blocks, and you can set time delays on these messages. (These kinds of messages are different to in-game messages – they only send messages to other behaviors and these messages are not shown to the player in-game.)

In this tutorial we are going to use the power of timed messages to make a spring that launches the player into the air.

Place down an item, and open its Advanced Behaviors.

What we want to find first is a block that can control the player’s motion. With a bit of exploration we will find that under the Control tab there is a block that reads “Lock players vertical speed at [100]”.

Locking the player’s speed doesn’t seem like spring behavior. When thinking about a behavior you would like to create, you need to have a good look around at all the blocks and tokens to see what you tools there are to create your behavior with. This can seem limiting when you can’t find that exact thing you’re looking for, but usually you can achieve what you want using an alternative method. The “Lock players vertical speed at [100]” block was the only block that affected the player’s motion, so we have to find a way to use it. Drag this block into the working area.

The default speed for this block is 100 and that makes the player travel downwards at a steady speed. We want the player to travel upwards fairly fast, so change this value to -500. You can tweak this value as you please.

Now we need to find an event block to start the whole sequence. When the player touches our spring we want him to be launched, so we need a player-touch event. Find the event “When touch by [  ] starts” under the Events tab, and drag it into the working area. Find “the player” token under the Sensing tab, and drag it into the blank slot. Then snap the “Lock players vertical speed at [-500]” block underneath it.

If we leave this as it is, then the player will continue to travel upwards at a fast and steady pace. We want to have the player decelerate as he loses speed from the initial launch, and we can use delayed messages to trigger changes in the player’s vertical speed.

To send a message with a timed delay, find the “Send self message […] in [100] ms” block under the Communications tab. Drag it out and snap it under our stack. Click the […] slot and select (New…) from the drop-down menu. Name the message “Slow player to -400” and click create message.

The default time delay is 100 ms, which is tenth of a second. We want the player to be speeding into the air at the initial speed for a while longer than a tenth of a second. Half a second seems reasonable, so change this value to 500 ms.

Just sending a message won’t actually do anything unless we have a block to receive the message. Find the “When I receive message of […]” block under the Events tab and drag it out into the work area. Click on the […] message slot and find the “Slow player to -400” message.

We want this new stack to decelerate the player, so find another “Lock players vertical speed at [100]” block and snap it under the message receiver event block. Set the new vertical speed to -400.

This stack will start the player’s deceleration, so we want to send out another time delayed message to trigger another change in the player’s speed. Find another “Send self message […] in [100] ms” block and snap it underneath. Keep the time at 100 ms for this block, and create a new message “Slow player to -300” in the blank slot.

Now continue to make stacks like this with a speed decrease of -100, until you finally create a stack that sets the player’s vertical speed to 0. At this point you don’t need a message to trigger anything else, as the in-game gravity will take over to make the player fall naturally.

You can tweak any of the values to achieve different speeds. Once you are done, save your work and close the advanced behavior editor.

Test out your new creation by previewing the game. The possibilities for interesting games are endless with items like these, and you can make them all yourself.

Here’s a quick game I made with my new springs: http://gamefroot.com/?post_type=game&p=37909

To learn more about the Advanced Behavior Editor, click here.

Leave a Reply