Hello. I want to attach a head to my actor, separately from the body. But in this case, I'm talking about a 2D-Actor.
So I used "AddAttachment" to put an entity onto my actor (named Honda)...
ENTITY
{
SPRITE = "actors/Honda/hondahead01.png"
}
So far it worked, but when I try to manipulate that attachment, my code does nothing, and neither do I get any informative debug-log.
(The following code is meant to change the attached file to fit the actor's direction.)
this.AddAttachment("actors/Honda/hondahead01.entity", true, -45, -384);
var Hondahead = this.GetAttachment(0);
while(true) {
if(this.Direction=="DI_LEFT") {
Hondahead.SetSprite("actors/Honda/hondahead01.png");
}
if(this.Direction=="DI_RIGHT") {
Hondahead.SetSprite("actors/Honda/hondahead02.png");
}
Sleep(20);
}
I have tried several variations of this code, changing the "DI_LEFT" to "LEFT" etc., calling the attachment's filename instead of an index number, and other details.
But since I won't get any failure messages in the log I don't know what is wrong and I must suppose that there several faults in it, which increases my confusion.
So I beg for help, please!