So, I’ve always been asking quite complex questions when I come around. The reason being, I come from more complex programming backgrounds, but I’ve began teaching a coding course, and CoSpaces is actually quite a lot more than my expectations. I’m really glad, but I feel kinda dumb that I can’t adapt my programming back to more basic levels.
So currently, I’ve been doing this so that my CoSpaces objects have special methods:
class SpecialDoor {
doorItem: AnimatedItem;
open: boolean;
constructor(doorItem: AnimatedItem) {
this.doorItem = doorItem;
}
public open() {
this.open = true;
this.doorItem.animation.play("Open");
}
public close() {
this.open = false;
this.doorItem.animation.play("Closed");
}
};
let myDoor = new SpecialDoor(Scene.getItem('tsWJBKWt') as AnimatedItem);
I don’t know about you, but this actually seems a bit overkill for the behaviour I’m looking for. The goal is simply to have a door that tracks when it is open and when it is closed, which can then be grabbed by other code in my Scene. I definitely don’t want to make something too complex for what I want to do.
Anybody have any ideas for a way I can simplify this?