Bitflinger Games docs

Run faster

You'll learn: what a line of code is, and how one number changes a game.
Time: 5 minutes.

Try itOpen this lesson in the Bitflinger Games app to try it.

The game

This lesson's game is built on Starter World: a meadow with trees, lamps and ten coins to collect. Play it first. Run around and get a feel for how fast you move.

The code

Open layer.gd. It holds this:

extends Node
## Lesson 1: Run faster. Change the number, then play.


func _ready() -> void:
	Variations.set_rule("player.speed", 7.0)

Most of that is the same in every layer, and you can leave it alone for now. The line that matters is the last one:

	Variations.set_rule("player.speed", 7.0)

Read it from left to right:

The line starts with a tab. That tells the game the line belongs to _ready, the part of your layer that runs once, when the game starts.

Change it

Change 7.0 to 14.0:

	Variations.set_rule("player.speed", 14.0)

Play again. You run twice as fast.

Try this

What you learned

Next: Make it dusk.