Hello,
I've created a class that serves as an 8-directional container. My intention is to be able to put objects of any type into this class, and be able to reference them by their direction:
class octal_container:
var up
var upright
var right
var downright
var down
var downleft
var left
var upleft
The issue is, in the setup() function I've created for the class, already it seems my variables aren't being 'set'. Here's the function within the octalcontainer class:
func set_up(u_, ur_, r_, dr_, d_, dl_, l_, ul_):
self.up = u_
self.upright = ur_
self.right = r_
self.downright = dr_
self.down = d_
self.downleft = dl_
self.left = l_
self.upleft = ul_
if !is_instance_valid(up):
print("warning: 'up' object is invalid on octal_container")
print("up should be " + u_)
Here's the call to that setup function from another class:
eye_animations = dir.octal_container.new()
eye_animations.set_up("u", "ur", "r", "dr", "d", "dl", "l", "ul")
And this gets printed to the console:
warning: 'up' object is invalid on octal_container
up should be u
Can anyone see what I'm doing wrong? Thank you.
P.S. Please forgive the weird formatting. I'm not sure what I did wrong there, either.