Hi! We are so glad that you made a video about our game! You find some unfounded bugs, well play! ^^ By the way, sorry for the 'A' wrong indication, the game was made for controllers :/ You did well even if you were solo! Thank you!
Lortedo
5
Posts
1
Topics
10
Followers
4
Following
A member registered Feb 15, 2019 · View creator page →
Creator of
Recent community posts
Superpowers community » SUPERPOWERS — HTML5 2D+3D GAME MAKER » Game Scripting & Shaders · Created a new topic GetBehaviour with interface
Hello guys !
Do you know a way to getBehavior with an interface passed as an arg.
My problem is that I created a IInteractable interface, implemented on some behavior.
When I press E input, I want to get the component (if it exists) that implements the interface of the actor in front of the character.
Here's my code:
interface IInteractable
{
interactable(): void;
} class LightBehavior extends Sup.Behavior implements IInteractable {
interact()
{
this.switchLight();
}
switchLight()
{
/* CODE OMITTED */
}
}
Sup.registerBehavior(LightBehavior); class CharacterBehaviour extends Sup.Behavior
{
update()
{
if (Sup.Input.isKeyDown("E"))
{
/* Get actor in front of the character*/
/* THE PROBLEM: Get IInteractable interface of the actor*/
}
}
}
Thank you guys!