Skip to content

TABmk/godot-4-fog-of-war

Repository files navigation

Let's make it better:

Rate

Fog of war for Godot 4+

Original author: @uheartbeast

What's new

  • Godot 4+ support
  • Better exports for editor
  • Debounce
  • Optimizations (re-render only when it really needs and cache things)
  • Character following example

Video (clickable)

Click

How to use

As new project

The repo itself is a ready to use Godot project.

Just download it and import as new project.

Simple character with script for movement is included.

Add to existing project

  • Select your main scene Node2D object
  • Attach script to it
  • Copy code from game.gd and paste it to your editor
  • Create "light" texture. See example: Light.png
  • Edit code as you want
  • Add Sprite2D to scene. This will be your fog
  • Disable "Centered" property under Offset tab on your fog object
  • Select fog object, open Material, click new CanvasItemMaterial. Click on it, set Blend mode property to Multiply

By default, it requires CharacterBody2D object.

Check _process and _input functions if you want to adapt the code for your project.

⚠️ Warning

_process function is using a .get_input() method which is declared in player.gd example.

About

Fog of war (or auto-mapping) for godot 4+

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published