Skip to content

Latest commit

 

History

History
193 lines (136 loc) · 4.03 KB

File metadata and controls

193 lines (136 loc) · 4.03 KB

📦 Installing Fox

starting from scratch

1 - New Godot Project

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

2 - Clone this repo next to your-game

git clone https://github.com/uralys/fox

To keep same paths and res://, symlink godot elements in the /fox folder like this:

macOS / Linux:

cd your-game
ln -s ../fox/fox fox

Windows / WSL:

On WSL, ln -s creates a Linux symlink that Godot (running as a native Windows app) cannot resolve. You must use a Windows NTFS junction instead:

cmd.exe /c "mklink /J C:\path\to\your-game\fox C:\path\to\fox\fox"

Note: To use check-projects on WSL, symlink your /mnt/c/ repos into your Linux home:

ln -s /mnt/c/Users/chris/Projects/uralys/gamedev/fox ~/Projects/uralys/gamedev/fox
ln -s /mnt/c/Users/chris/Projects/uralys/gamedev/your-game ~/Projects/uralys/gamedev/your-game

3 - Declare your main Scene

create the main script

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():
  super._ready()
  print(G.BUNDLE_ID + ' is running!')

Note: super._ready() is mandatory — it sets up the Fox core nodes and settings (screen reference, debug flags, notifications).

set as main scene

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"

create mandatory nodes

You must setup a few nodes in your main scene:

by default:

  • app should be a CanvasLayer
  • app/scene should also be a Node2D
  • app/hud should be a CanvasLayer

To change these defaults, edit the fox/core "extends XXX"

app
├── scene
└── hud

4 - Declare Fox default config

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"

Other libs are autoloads too — add the ones you use, e.g. Controls="*res://fox/libs/controls.gd" (input), HotReload, Sound, Generate, AppStore / PlayStore. See each lib's doc.

and set few default options

[bundle]

id="your-game"
version="0.0.1"
versionCode=1
platform="xxx"
env="debug"

Let's craft!

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:game

and now let's start your editor and enjoy developing!

fox run:editor

🏹 extending default Fox Nodes

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/globals.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.