Godot Playground

Examples

133 projects that open straight in the editor. Every one is plain GDScript that builds its own scene, so there is nothing to import.

133 of 133 examples
Motion12
2D

Bouncing ball

A ball crossing the screen and bouncing off the edges. The smallest loop there is: read delta, move, invert the velocity.

Polygon2DColorRect
2D

Follow the mouse

Two shapes chasing the same target, one with lerp and one with move_toward. The lag between them is the whole lesson.

Node2DPolygon2DInputEventMouseMotion
2D

Orbit and spin

Three nested Node2D and two rotations. The child orbits because the parent turns, and the grandchild orbits the child.

Node2DLine2DPolygon2D
2D

Chase and flee

The runner flees the mouse and the chaser follows the runner. Both use direction_to, only the sign changes.

Node2DLine2DVector2
2D

Screen wrap

An Asteroids ship and eight rocks that leave one edge and come back on the other. Two calls to wrapf do it.

Node2DPolygon2DInput
2D

Mouse trail

A Line2D that gains a point where the pointer is and drops the oldest one once it is full. The width curve and the gradient do the fade.

Line2DGradientCurve
2D

Draw with the mouse

Hold the left button to draw. Each stroke is a new Line2D, and the right button clears the canvas.

Line2DInputEventMouseButtonInputEventMouseMotion
2D

Follow a curve

A Curve2D built point by point, drawn with tessellate and walked by three PathFollow2D. Progress is the only thing that changes.

Path2DPathFollow2DCurve2D
2D

Spring damper

A critically damped spring and a lerp follower tracking the same moving target. The spring keeps up, the lerp trails behind.

Polygon2DLine2DLabel
2D

Grid snap

A free position moving in a loop and the same position passed through snapped. The blue square only ever sits on a grid node.

Polygon2DLine2DVector2
2D

Bob and float

Nine shapes on the same sine wave, each one a phase step ahead of the last. No Tween and no AnimationPlayer.

Node2DLine2DTime
2D

Frame vs delta

The same speed constant applied with and without delta, with a distance readout on each row. The second one is only as fast as the frame rate.

Polygon2DLabelEngine
Physics15
2D

Platformer

Gravity, jump and floor detection with CharacterBody2D, over platforms built from code.

CharacterBody2DStaticBody2DCollisionShape2D
2D

Box pile

Sixteen boxes dropped between two walls. The first thing to try when you want to see the solver work.

RigidBody2DCollisionShape2DRectangleShape2D
2D

Joint chain

Twelve links pinned to each other and a heavy weight at the end. Click to push the chain and watch it settle.

PinJoint2DRigidBody2DStaticBody2D
2D

Spring joints

Three springs with the same rest length and different stiffness and damping, side by side.

DampedSpringJoint2DRigidBody2DLine2D
2D

Area detector

A zone that counts what falls through it, using the body_entered and body_exited signals.

Area2DRigidBody2DLabel
2D

Vision cone

Twenty eight rays fanned toward the mouse. Each one turns red where it hits a wall, which is line of sight in its simplest form.

RayCast2DLine2DStaticBody2D
2D

Shape cast

A box that asks where it would stop before moving. The ghost is the safe fraction the cast returns.

ShapeCast2DPolygon2DStaticBody2D
2D

One way platforms

Jump through the blue platforms from below and land on them from above. One property does all of it.

CharacterBody2DCollisionShape2DStaticBody2D
2D

Bounce and friction

Three balls dropped from the same height with three PhysicsMaterial settings. The bounce value is the whole difference.

PhysicsMaterialRigidBody2DStaticBody2D
2D

Conveyor belt

Two belts that never move a pixel. constant_linear_velocity drags whatever is touching them.

StaticBody2DRigidBody2DCollisionShape2D
2D

Impulse blast

A wall of 54 boxes and a click that pushes them away, with the force falling off by distance.

RigidBody2DInputEventMouseButtonCollisionShape2D
3D

Physics drop

Click to drop a RigidBody3D on the floor and watch it stack. The ones you spawn clear themselves after ten seconds.

RigidBody3DStaticBody3DCollisionShape3D
3D

Domino chain

Twenty pieces on a curve and one impulse on the first. Everything after that is the solver.

RigidBody3DBoxShape3DCamera3D
3D

Hinge door

A door held by a hinge with an angle limit. Click to push it and see where the limit stops the swing.

HingeJoint3DRigidBody3DStaticBody3D
3D

Jelly cubes

Three SoftBody3D cubes landing with different stiffness. The mesh itself is what deforms.

SoftBody3DBoxMeshStaticBody3D
Particles6
UI16
Control

Control gallery

The basic controls on one screen, each one reporting to the same label through its signal.

ButtonCheckBoxOptionButtonHSliderSpinBoxLineEdit
Control

Containers tour

The same four boxes handed to four containers. Layout in Godot is picking who arranges the children.

VBoxContainerHBoxContainerGridContainerCenterContainer
Control

Anchors and presets

Six panels pinned with layout presets. Resize the game panel and every one keeps its corner.

ControlPanelStyleBoxFlat
Control

Theme by code

The same three nodes twice, and the difference is a handful of add_theme overrides.

StyleBoxFlatButtonProgressBar
Control

Rich text

Bold, color, wave, shake and rainbow, all of it BBCode tags inside one label. No animation node involved.

RichTextLabel
Control

Progress and timer

A Timer filling a bar, with pause and resume. The bar reads time_left, it does not count on its own.

ProgressBarTimerButton
Control

Drag and drop

Chips moving between slots. Three methods do all of it: _get_drag_data, _can_drop_data and _drop_data.

PanelContainerGridContainerColorRect
Control

Tree view

A scene tree with two columns, built from a nested dictionary by one recursive function.

TreeTreeItem
Control

Inventory list

An ItemList with multi selection, dropping the selected rows and putting them back.

ItemListButton
Control

Tabs and splits

A side panel and three tabs sharing the width. Drag the divider and both sides follow.

TabContainerHSplitContainerPanelContainer
Control

Node graph

Four nodes with ports you can wire by dragging. GraphEdit draws the curve, accepting the connection is your call.

GraphEditGraphNode
Control

Color picker

The full picker wired to a live preview, the hex readout and a row of saved swatches.

ColorPickerColorRect
Control

Popups and dialogs

A context menu and two dialogs, each one reporting back through its own signal.

PopupMenuAcceptDialogConfirmationDialog
Control

Keyboard focus

Nine buttons wired in a ring through focus_neighbor, walked with tab and the arrow keys. UI that works without a mouse.

ButtonGridContainer
Control

Virtual joystick

A stick that clamps to its ring and drives a dot around. On a phone the same code answers to touch.

PanelStyleBoxFlatInputEventMouseMotion
Control

Responsive dashboard

Six cards in a grid that goes from three columns to two when the viewport gets narrow.

GridContainerPanelContainerMarginContainer
3D scene12
3D

Primitives tour

The six primitive meshes on a spinning ring, each one with its own material: metal, rough and emissive.

MeshInstance3DStandardMaterial3DDirectionalLight3D
3D

Wave grid

A grid of 196 cubes riding a sine wave. Two nested loops on setup, one line of math per frame.

MeshInstance3DBoxMeshCamera3D
3D

Move a cube

WASD driving a CharacterBody3D around pillars, with a camera that trails behind. No mouse look.

CharacterBody3DCamera3DStaticBody3D
3D

Orbit camera

Drag with the left button to swing the camera around the centerpiece, and use the wheel to zoom. Yaw, pitch and distance are the whole state.

Camera3DInputEventMouseMotionInputEventMouseButton
3D

Look at target

Eight cones running look_at on the same moving orb. One call per frame replaces all the trigonometry.

Node3DMeshInstance3DOmniLight3D
3D

Solar system

Nested Node3D pivots, each spinning at its own rate. A moon orbits its planet and inherits the planet orbit for free.

Node3DMeshInstance3DOmniLight3D
3D

CSG shapes

A box kept in intersection with a sphere, drilled by three cylinders that switch between subtraction, union and intersection every two seconds.

CSGCombiner3DCSGBox3DCSGSphere3DCSGCylinder3D
3D

MultiMesh forest

Four thousand trees drawn by two MultiMeshInstance3D nodes, with a per instance color on the crowns.

MultiMeshInstance3DMultiMeshCylinderMesh
3D

Sprites in 3D

Billboarded Sprite3D gems over a texture painted pixel by pixel in code, each one named by a Label3D. The center sign keeps billboard off for comparison.

Sprite3DLabel3DImageTexture
3D

Lights tour

The same geometry and the same white material three times. A cull mask gives each light its own third of the scene.

OmniLight3DSpotLight3DDirectionalLight3D
3D

Reflection probe

Metallic spheres mirroring a colored room without screen space reflections. Three roughness values show how fast the mirror turns into a blur.

ReflectionProbeStandardMaterial3DCamera3D
3D

Transform basics

Five boxes and five Transform3D written by hand: identity, origin, rotated Basis, scaled Basis and the three combined. A ghost marks where identity sits.

Transform3DBasisMeshInstance3D
Shaders14
2DShader

Canvas shader

A fullscreen canvas shader animated by TIME. Change a uniform, save, and the project reloads.

ColorRectShaderMaterialCanvasLayer
2DShader

Palette swap

The sprite stores palette indices instead of colors, so cycling the palette repaints the whole art.

Sprite2DImageTextureShaderMaterial
2DShader

CRT screen

Barrel curve, scanlines and chromatic split over a plain 2D scene. The whole look is one fullscreen pass.

ColorRectCanvasLayerPolygon2D
2DShader

Vignette and grain

Desaturation, vignette and film grain over a 3D scene, in eleven lines that read the screen texture.

ColorRectCanvasLayerMeshInstance3D
3DShader

Spatial shader

A sphere whose vertices ride a wave while the emission pulses, written in a spatial shader.

MeshInstance3DShaderMaterialWorldEnvironment
3DShader

Dissolve

A noise texture built in GDScript and a discard in the shader, with a burning edge at the threshold.

MeshInstance3DNoiseTexture2DFastNoiseLite
3DShader

Rim light

The angle between the normal and the view, raised to a power. Three shapes, three rim powers.

MeshInstance3DShaderMaterialWorldEnvironment
3DShader

Toon shading

Lighting quantized into bands inside the shader light function, with a hard specular dot.

MeshInstance3DDirectionalLight3DShaderMaterial
3DShader

Sky shader

A procedural sunset with stars, written as shader_type sky. The sun disc follows the light node.

SkyShaderMaterialDirectionalLight3D
3DShader

Depth fog

A quad in front of the camera reading DEPTH_TEXTURE, so the fog knows how far every pixel is.

QuadMeshCamera3DShaderMaterial
3DShader

Heat haze

Noise pushing the screen UV around, masked to the lower half so the difference is easy to see.

ColorRectNoiseTexture2DCanvasLayer
3DShader

Water plane

Waves in the vertex shader with the normal recomputed from the derivative, so the light follows them.

PlaneMeshShaderMaterialMeshInstance3D
3DShader

Infinite grid

One plane and no texture. fwidth keeps every line a pixel wide no matter how far the camera is.

PlaneMeshShaderMaterialCamera3D
3DShader

Triplanar mapping

Four meshes with no UV map, textured by projecting from the three world axes and blending by normal.

MeshInstance3DNoiseTexture2DShaderMaterial
Procedural13
2D

Noise viewer

The six FastNoiseLite types side by side, same seed and no fractal, so the character of each one shows.

FastNoiseLiteNoiseTexture2DTextureRect
3D

Terrain from noise

A heightmap turned into an ArrayMesh with SurfaceTool, colored by height through vertex colors.

SurfaceToolArrayMeshMeshInstance3D
2D

Island generator

Noise multiplied by a radial mask and painted into an Image band by band. Click for another island.

FastNoiseLiteImageImageTexture
2D

Maze generator

A perfect maze carved by a backtracker. The passages appear in the order they were dug, colored by that order.

ImageImageTextureSprite2D
2D

Dungeon rooms

Rooms placed without overlapping, then a random walk digging the corridor between each pair.

Polygon2DLine2DRect2i
2D

L-system tree

A string rewritten four times by two rules and then read as turtle moves, one Line2D per branch.

Line2DLabel
2D

Flow field

Noise gives every point on the screen an angle. The arrows show the field and the particles follow it.

FastNoiseLiteLine2D
2D

Marching squares

The contour of a noise field, redrawn as the threshold sweeps. The field never changes, only the cut.

Node2DFastNoiseLiteLabel
3D

ImmediateMesh lines

A mesh cleared and rebuilt vertex by vertex every frame, with a line strip and a line surface.

ImmediateMeshMeshInstance3DStandardMaterial3D
3D

SurfaceTool solid

The same solid committed twice from SurfaceTool, flat and smooth. Only the smooth group changes.

SurfaceToolArrayMeshLabel3D
3D

GridMap voxels

A MeshLibrary built at runtime and a GridMap filled from a heightmap, one cube per cell.

GridMapMeshLibraryBoxMesh
2D

TileMap by code

A TileSet whose atlas is an Image painted pixel by pixel, placed cell by cell on a TileMapLayer.

TileMapLayerTileSetTileSetAtlasSource
2D

Geometry helpers

Three Geometry2D calls with the result drawn: polygon intersection, convex hull and polygon offset.

Geometry2DPolygon2DLine2D
Navigation9
2D

Agent 2D

A navigation region baked from code and an agent touring four corners through it. Click anywhere to send it somewhere else.

NavigationRegion2DNavigationAgent2DNavigationPolygon
3D

Agent 3D

The same idea in three dimensions, with the NavigationMesh baked from primitive meshes at load. Click the floor to pick a destination.

NavigationRegion3DNavigationAgent3DCharacterBody3D
2D

Dynamic obstacles

Three obstacles stepping in and out of the navigation mesh. Every swap rebakes the region and the agent takes whichever lane is still open.

NavigationObstacle2DNavigationRegion2DNavigationAgent2D
2D

AStarGrid2D

A grid where walls block cells and the yellow ones cost six times more to cross. The result is the cheapest route, not the shortest one.

AStarGrid2DPolygon2DLine2D
2D

AStar2D graph

Forty points linked by distance, with AStar2D routing between two of them. Nothing here is a grid, the graph is whatever you connect.

AStar2DLine2DPolygon2D
2D

Seek and flee

Seek and flee are the same two lines with one sign flipped. The drawn vectors are the desired velocity, the current one and the difference between them.

Node2DPolygon2DLine2D
2D

Wander

Each agent aims at a point that only slides a little around a circle in front of it. That is what makes wandering read as intent instead of noise.

Node2DLine2DRandomNumberGenerator
2D

Boids

Seventy two boids running separation, alignment and cohesion against everything inside a small radius. Each one is colored by how many neighbors it can see.

Polygon2DLine2DNode2D
2D

Patrol state machine

An enum and a match block driving patrol, chase and return. The strip at the bottom is the last few seconds of state.

Node2DLabelLine2D
Camera8
Animation9
2D

Tween easings

Five squares crossing the screen, one per transition curve. The fastest way to see what each easing does.

TweenPolygon2DLabel
2D

Tween chains

One tween running four steps in a row. tween_callback lights up the step on screen and parallel puts two properties on the same step.

TweenPolygon2DLine2D
2D

Animation by code

A position track and a color track written key by key at startup, with no .anim file. The timeline below shows the same keys the code inserted.

AnimationPlayerAnimationAnimationLibrary
2D

Curve resource

A Curve built point by point and read with sample(t). The graph is drawn from the same resource that moves the square, next to a square driven by plain time.

CurveLine2DPolygon2D
2D

Sprite frames by code

An eight frame walk cycle painted into Image buffers at startup and fed to an AnimatedSprite2D. The strip at the bottom is the SpriteFrames itself.

AnimatedSprite2DSpriteFramesImageTexture
2D

Skeleton 2D

An articulated arm made of a single Polygon2D skinned to two bones. Rotating a Bone2D moves the vertices weighted to it.

Skeleton2DBone2DPolygon2D
2D

Squash and stretch

The same jump with the same timing on both sides, and only the right one tweens scale. Three extra lines are the whole difference.

TweenPolygon2DColorRect
2D

State driven anim

Idle, windup, dash and recover, each with its own tween. Entering a state kills the tween of the previous one so they never fight over the same property.

TweenPolygon2DLabel
3D

Skeleton 3D pose

A six bone chain added by code, posed every frame with set_bone_pose_rotation. Each BoneAttachment3D carries the mesh that rides its bone.

Skeleton3DBoneAttachment3DMeshInstance3D
Audio6
Input5
Data8