Aaron Aguayo

Technical Game Designer Portfolio

Conditionally show or hide parameters in the Inspector

I learned about func _validate_property(property : Dictionary) in Godot. This is something I’ve been wanting to learn for a while but finally had a good script to use it in. Essentially the idea is conditionally showing or hiding exported variables/parameters in the Inspector.

Note: Make sure the script has @tool at the top.

In this example the objective was to hide the pattern parameter whenever the movement type was set to anything other grid-based movement.


Using a setter function, we notify that we have changed the property list whenever we update the movement type, which calls the _validate_property function for each property (variable) found. The parameters passed in are the different properties on this script, so we match for the pattern property and check for movement type to determine whether we hide or show the property.

This is what it looks like in the Inspector.

Negative lighting for the eyeball enemy, grid-based movement script.

I have recently made some progress on the game, creating basic enemy pawns and their movement options, starting with a basic enemy grid-based movement that just moves from tile to tile in a given pattern.

I also started experimenting with negative lighting in Godot, it creates very interesting effects. Essentially the way it works is that the light source will subtract the color that it emits from the lit objects. I ended up using it to color the eyeball enemy’s spotlight, a mixture of negative blue light and red light that lit up the fog.

Speaking of which, this eyeball enemy uses the grid-based pattern movement that was implemented yesterday. It has a very basic functionality, taking in an array of vector directions that the enemy will move in, and then execute those grid-based movements on a timer. This script needs to be expanded and worked on much more so it can be reused, and can have many different behaviors that can spice up the gameplay.

Posted in

Leave a comment