Small projects you build with your teacher. Download the starter, then in Godot's Project
Manager click Import and pick the zip. Every TODO in the code is
a step you will write together.
Drop stones with the mouse. Left click puts a stone in the level, right click puts one on the player, and only one kind stays where you dropped it.
preload() Load a scene once, so you can make copies of it later.instantiate() Make a new copy: a bullet, an enemy, a coin.add_child() Put the copy in the game. Until you do, nobody can see it.get_parent() Reach the node above this one. A bullet goes in the level, not inside the player who fired it.Shoot crates, balloons and a wall. Every hit shows which signal ran, and only the things in the Target group break.
.connect() Run your function when something happens: a hit, a timer running out, a button pressed.body_entered Something solid touched this area: a wall, a crate, the player.area_entered Another area touched this one: a balloon, a pickup, a hitbox.is_in_group() Ask what kind of thing you hit before doing anything to it.queue_free() Remove something from the game for good: a grabbed coin, a spent bullet, a beaten enemy.Walk into the circle and a slime chases you. A yellow arrow shows the Vector2 from the slime to you, and how long it is.
Vector2 Two numbers, x and y. A place (where something is) or an arrow (which way it goes).normalized() Keep the direction, drop the length, so speed alone decides how fast. Chasing, aiming, homing.distance_to() How far apart two things are. Close enough to notice, to grab, to talk to, to open a door?Coins drop in random spots and colors. Grab them before they vanish. When every coin is gone, a bigger wave drops.
randi_range() A random whole number between two numbers: how many enemies, how much damage.randf_range() A random decimal between two numbers: a spawn spot, a wait time. Godot 3 called it rand_range().randi() % size() Pick one thing from a list at random: a color, a sound, an enemy type.size() How many things are in a list. Add one more and every line using size() keeps working.tree_exiting Hear when something leaves the game, however it left. Count enemies left, then start the next wave.A guard walks a route, waits at every corner, and chases you if you get close. Its label shows the one thing it is doing right now.
enum State Name the things something can be doing, so it only ever does one: an enemy, a door, a boss fight.match Do something different for each state.PackedVector2Array A list of places: a patrol route, waypoints, the corners of a shape.size() Loop back to the start: (point + 1) % route.size() goes 0, 1, 2, 3, 0, 1...