Skip to content

Ertain/Random-Name-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Random name Generator

This is a random name generator originally written by Trey Hunner, ported to the Godot Engine.

How to use it in your Godot game:

Place the "names" directory in your main Godot repository, and put the script "random_names.gd" with your scripts. Next, edit the FILES dictionary of "random_names.gd" to point to your "names" directory. So it looks like this:

FILES = {
  'first:male' : 'res://path/to/names/male.first.txt',
  'first:female' : 'res://path/to/names/female.first.txt',
  'last' : 'res://names/path/to/all.last.txt'
}

Just substitute path/to/ with the actual path to the "names" directory.

Next, add something like this to your Godot game:

var Names = preload("res://path/to/random_names.gd")
func _ready():
    randomize()
    var names = Names.new()
    var random_name = names.get_full_name()
    var male_name = names.get_full_name('male')
    var female_name = names.get_full_name('female')
    var male_first_name = names.get_first_name('male')
    print("Male name: ", male_name)
    print("Female name: ", female_name)
    print("Random male name: ", male_first_name)

The output from this project would look like this:

Male name: Herman Palmer
Female name: Frances Lewis
Random male name: James

About

A random name generator for the Godot Engine

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published