https://github.com/godotjs/godotjsexample
An example project for demonstrating the usage of GodotJS
https://github.com/godotjs/godotjsexample
example godot godotjs javascript scripting tutorial typescript
Last synced: about 1 year ago
JSON representation
An example project for demonstrating the usage of GodotJS
- Host: GitHub
- URL: https://github.com/godotjs/godotjsexample
- Owner: godotjs
- License: mit
- Created: 2024-04-03T12:47:19.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-28T10:10:20.000Z (over 1 year ago)
- Last Synced: 2025-04-06T15:25:25.150Z (about 1 year ago)
- Topics: example, godot, godotjs, javascript, scripting, tutorial, typescript
- Language: TypeScript
- Homepage:
- Size: 14.9 MB
- Stars: 16
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GodotJSExample
This project includes examples at different complexity levels, incrementally introducing and utilizing more engine features.
A prebuilt version of `Godot Editor` can be downloaded from [GodotJS-Build](https://github.com/ialex32x/GodotJS-Build/releases).
> [!NOTE]
> Run `npm i` in the project folder before opening it in godot editor.
>
> And, so far, `npx tsc` (or `npx tsc -w`) must be run on your side to make the changes to the scripts take effect, since all `.js` files are not included in this git repository.
## Snake
A simple snake game.
In this example, only a limited subset of Godot's features is utilized:
* script lifetime callbacks (_ready, _process etc.)
* resource loader
* using primitive types (float, bool, string, StringName)
* export variables
[](./snake/snake.ts)
## JumpyBird
Additional features used:
* Signals (connect `area_shape_entered` signal with js class member function)
[](./jumpybird/jumpybird_main.ts)
## Piggy
Additional features used:
* `signal_` annotation
* `onready_` annotation
* `export_` annotation
[](./piggy/piggy_main.ts)
## Audio Generator
This is an example originally from https://godotengine.org/asset-library/asset/526
It utilizes [ZzFXM](https://keithclark.github.io/ZzFXM/) which is written in pure javascript to play a 8bit-ish sound without audio media files.
[](./jumpybaudio_generatorird/generator_demo.ts)