This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a very messy prototype Autoload to test Nakama with a Dedicated Server | |
# This file won't do much of anything on its own, but I'm using it to drive | |
# a dedicated server for a game already made | |
extends Node | |
enum OP { | |
HOST, | |
STARTGAME, | |
LOBBYMESSAGE, | |
REGISTER_AS_SERVER, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var node = 2; // Node number 2... for a random node you can do: var node = irandom( path_get_number( path ); | |
// Set position to the position of the node | |
x = path_get_point_x( path, node ); | |
y = path_get_point_y( path, node ); | |
// path_position is a normalized value based on the length of the path. | |
// path_position = 1 is the end of any path and path_position = 0.5 would be halfway of any path. | |
// After setting the physical position of an object to match that of the path's nodal position, | |
// you then have to set the normalized position of the path if you intend for the object to | |
// continue following along that path. If I'm unclear I'll try to explain later. | |
path_position = ( 1 / path_get_number( path ) ) * node; |