Start by opening Godot Editor and create a new project with Godot > New Project > Create folder >
your-game
Then > Select Current Folder
Edit your project settings and Create & Edit
git clone https://github.com/uralys/fox
To keep same paths and res://
, symlink godot elements in the /fox
folder like this:
cd your-game
ln -s ../fox/fox fox
Create a src
folder and Create a new scene with Godot Editor, you can name it app.tscn
.
Then add attach a app.gd
script to this scene.
You can remove the default code and replace with:
extends 'res://fox/core/app.gd'
func _ready():
finalizeFoxSetup()
print(G.BUNDLE_ID + ' is running!')
Note: finalizeFoxSetup()
is mandatory to setup Fox core nodes and settings.
Finally, right click on your app.tscn
to Set as Main Scene
Or edit manually your project.godot
to declare:
[application]
run/main_scene="res://src/app.tscn"
You must setup a few nodes in your main scene:
by default:
app
should be aCanvasLayer
app/scene
should also be aNode2D
app/hud
should be aCanvasLayer
To change these defaults, edit the fox/core
"extends XXX"
app
├── scene
└── hud
Now you need to setup Fox default paths within the project.godot
[autoload]
section.
[autoload]
G="*res://fox/core/globals.gd"
DEBUG="*res://fox/core/debug.gd"
Gesture="*res://fox/libs/gesture.gd"
and set few default options
[bundle]
id="your-game"
version="0.0.1"
versionCode=1
platform="xxx"
env="debug"
At this point, you should have something like this:
.
├── fox
└── your-game
├──.godot
├── fox -> ../fox/fox
├── fox.config.json
├── icon.svg
├── project.godot
└── src
├── app.gd
└── app.tscn
You can have a look at your startup app:
fox run:start
and now let's start your editor and enjoy developing!
fox run:editor
To extend a Fox default Node, you can do like with did with the main scene: Extend the Node from you script.
For example, to extend Globals and add your own:
Create a globals.gd
extends 'res://fox/core/main.gd'
And replace the autoload in project.godot
with yours:
[autoload]
G="*res://src/globals.gd"
To better use Fox core, screens and components, you can organise your project like this:
.
├── fox
└── your-game
├── assets
│ ├── map.png
│ └── logo.svg
├── fox -> ../fox/fox
├── fox.config.json
├── project.godot
├── readme.md
└── src
├── main.gd
├── main.tscn
├── player.gd
├── router.gd
└── screens
├── home.tscn
└── home.gd
🚀 You can continue by extending the Router to add your first screens.