Animation State Machine
This example demonstrates how to create a character animation system using a Finite State Machine (FSM) with smooth transitions between different character states.
The Defold examples show individual concepts and features of Defold with focused, small practical reference projects and snippets to study or reuse.
This example demonstrates how to create a character animation system using a Finite State Machine (FSM) with smooth transitions between different character states.
This example shows how to tween animate the position of a game object.
This example shows how to chain two tween animations of the position of a game object. In addition, the scale and tint is animated separately.
This example shows how to set and animate the normalized cursor value.
This example demonstrates different easing functions available in Defold.
This example shows how to animate the rotation of a game object using the euler game object property.
This example shows how to use a flipbook animation in a sprite
This example shows Spine bone animation that blends when animation switches.
This example shows how a game object is rotated in discrete steps, matching the graphics of the progress spinner.
This example shows how to communicate between two script components in two separate game objects.
This example shows how to child a game object to a parent.
This example shows how to generate pseudo-random numbers in Defold using built-in math API.
This example shows how to put sprites in front and behind of eachother
This example shows how to use collection proxies to load and unload collections.
This example shows how to use collection proxies to show a splash screen while loading a game menu.
This example shows how to speed up or slow down animations in a collection proxy by changing the time step of the collection proxy.
This example shows how to dynamically spawn game objects with a factory component.
This example shows how to dynamically spawn bullet game objects using a factory component.
This example shows how to change the prototype game object used by a factory component.
This example shows how to spawn enemy game objects using a factory component and use a central manager to control movement and behavior of all enemies.
This example shows how to spawn enemy game objects using a factory component with different properties.
A GUI box node with an image texture and a script to make it act as a button.
This example shows how change the color of GUI nodes at run-time
This example shows how to drag a GUI box node.
This example shows how to get and set a font resource on a gui component.
This example shows how to get and set a material resource on a gui component.
This example shows how to get and set a texture resource on a gui component.
This example demonstrates how to add different health bars.
This example demonstrates the use of layouts.
This example shows how to load and set a dynamic texture on a gui box node.
This example demonstrates how to handle localization in games, Unicode text layout, RTL rendering, and runtime font switching for localization.
A GUI box node with an image texture and a script that react when pointer over this node.
This example shows how to create various types of progress indicators
This example demonstrates slice-9 scaling gui box node.
A GUI box node with "Clipping mode" set to "STENCIL". This makes it mask its child node (which is called "bunny").
Listens to input trigger "touch" and count mouse down duration in update method.
This example demonstrates how to pick a game object from the 3D scene.
Shows how to read mouse/touch movement and mouse/touch button state.
A very simple 8 ways movement setup with a single game object and a script that listens to input and updates the game object position accordingly.
Listens to text input trigger "type" and modifies the game object label with the alien's speech according to input. A "backspace" key trigger has also been added.
This example shows how to make sprites and particle sprites face the camera using a custom vertex shader.
This example demonstrates a simple way to create and apply a custom sprite shader for changing colors and customizing an outline.
This example shows how to use a noise function to generate clouds, smoke or similar effect using a shader.
Create a scrolling background using a repeating texture on a model quad.
This example shows how to create a custom material with two textures that blend together to create a pattern effect using screen space coordinates.
This example shows how to get local UV coordinates of a sprite regardless of sprite size
This example demonstrates how to create and apply an custom non-lit material to a 3D model.
This example shows how to apply a basic shader to a full screen quad.
This example shows how to set and animate a vertex attribute
This example demonstrates how to use the `model.get_aabb()` function in a 3D scene.
This example shows how to view and play skeletal animations on a glTF model.
This example shows how to use a cubemap to draw environment reflections on a model.
This example demonstrates how to use a glTF model.
This example demonstrates how to apply a vertex color shader using exported attributes from a 3D model.
This example demonstrates GPU skinning.
This example shows how to create a skybox using a cubemap texture.
Control a first-person camera using WASD and mouse to look with cursor lock.
This example shows how to make a game object continuously follow the mouse.
This example shows how to rotate a game object to look at the mouse cursor
This example shows how to rotate a game object to look at the object in 3D space.
This example shows how to move a game object in the direction it is rotated/facing.
This example shows how to make a game object move to the position the user clicks.
This example shows how to move a game object with accelerating speed.
This example shows how to move a game object.
This example shows a simple particle effect to imitate confetti.
This example shows a simple particle effect for imitating fire and smoke.
This example shows a fireworks effect made with particles.
This example shows particle effect modifiers. Modifiers are used to alter the path of emitted particles.
This example shows a simple particle effect. The particlefx component has all the values at default, except the image and animation used.
This example demonstrates the difference between local and world particle emission spaces. Two UFO objects move up and down, showing how particles behave differently when emitted in emitter space versus world space.
This example shows how to get and set ParticleFX emitter image, animation, and material at runtime.
This example demonstrates how to apply directional force to all dynamic blocks on touch/click and draws debug direction lines.
This example shows a simple setup with dynamic physics objects.
This example shows a simple setup with a dynamic body physics object and two dynamic wheel physics object joined together with a joint of type "hinge". The hinge joint can simulate an axle or a pin on which other object is rotating in respect to the base. The example shows how to create, destroy and change properties of the joints.
This example shows how to smooth physics motion in fixed update mode by interpolating a visual sprite while keeping the physics body fixed-step.
This example shows a simple setup with a kinematic physics objects. The difference between dynamic objects, simulated by the physics engine, and kinematic objects, that are user controlled, is clearly seen here.
This example shows how to create a knockback effect when hit.
This example shows a simple setup with a static pivot and two dynamic weights - physics objects joined together with a joint of type "fixed" and "spring". The fixed joint can simulate a rope and spring joint a spring. The example shows how to create the joints and change the gravity to affect the pendulums.
This example shows how to use physics raycasts to detect collisions along a straight line from a start point to an end point.
This example shows how a physics trigger is used to trigger an event. In this case the bunny sprite is disabled and enabled.
This example shows how to use a camera component and have it follow a game object. Click to toggle between following the game object and staying stationary.
This example demonstrates how to create script to control a 3D camera with the mouse. Scroll wheel is used to zoom in and out.
This example shows how to zoom an orthographic camera in and out by changing Orthographic Zoom while the camera is in Fixed mode.
This example shows how to apply a post-processing effect by drawing to a render target and then to a fullscreen quad using a post processing shader.
This example shows how to convert from screen to world coordinates while using a camera.
This example demonstrates how to convert 3D world coordinates to 2D screen coordinates using camera transformations.
This example shows how to make Fade-In and fade Fade-Out music.
This example shows how to change which sound a sound component plays
This example shows how to play a piece of music, stored as an .OGG file, with a sound component. The sound component is set to "looping" causing the music to never, ever stop.
This example demonstrates how to pan a sound effect according to a GO's(game object) position on the screen.
This is a performance test for sprites
This example shows how to change the image of a sprite
This example shows how to use the sprite animation cursor and frame count to manually select a specific frame
This example demonstrates flipping a sprite animation vertically and horizontally.
This example shows how to sample from more than one image when drawing a sprite
This example shows how to get the size of a sprite at run-time
This example shows how scroll the texture in the runtime using Texture Transform 2D Vertex Attribute, without using the sprite in the world space.
This example shows how tint a sprite at run-time
This example shows how to create timer and cancel it anytime, using built-in timer API.
This example shows how to create timer that repeats endlessly every second
This example shows how to create timer that triggers counting every 1s and can be triggered manually and asynchronously as a reaction to user input.