【Trouble】The actor will disappear when actor'size interpolate to negative.
Weiyu
Member Posts: 216
Hello everyone.I meet a big trouble.
The actor will disappear when actor'size interpolate to negative.
- My behaviors:
- interpolate "self.width" to "-100"
I don't know why it happened.
Please help me. Thank you.!
Comments
It happened because an actor can't have a width of -100. What did you want to have happen when it's width reached negative one hundred?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
The interpolate kind of "overrides" the actor's width all the way up to -100. Once the interpolate finishes, the actor goes "Now my width is -100! Wait, I can't be negative width. The smallest width I can have is 0. Best set myself to 0 then."
You can get around this by just interpolating the width to 0, then back to 100. Same effect as far as the user is concerned.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Weiyu You're setting the width here - not just subtracting 100 from the width. So just set it to 0.
Ah, I think you're right... she/he may not have understood how Interpolate works. Interpolate changes the value of an attribute from it's current value to a final value (in this case, -100) over a time period.
If you want to Interpolate from the actor's current width to a value one hundred less than that, you would do it this way:
Change Attribute self.NewWidth to self.Size.Width-100
Interpolate Attribute self.Size.Width to self.NewWidth
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@Armelline @RowdyPants @tatiang
Thank you for your reply.
I'm not have understood how Interpolate works that I was wrong.Sorry.
I want actor to negative gradual elongation.
This is my original behaviors:
Constrain Attribute
constrain "self.position.x" to "80+(self.size.width/2)"
Constrain Attribute
constrain "self.size.width" to "game.time*64"
I was going to use "Constrain Attribute" to gradual elongation, but it only positive elongation. So I tried use Interpolate to do it, but It couldn't come up with negative elongation all along.
Interpolate self.width to self.width + 400. That should work.
Thank you for your reply.
But that still can't work what I want to do.
I hope actor can negative elongation, not positive elongation.
I have no idea how to let actor negative elongation...
Just like this:
Change the plus to a minus:
constrain "self.position.x" to "80-(self.size.width/2)"
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
This is amazing!!! The problem worried me for long time.
I can't believe my eyes, this is so easy.
I really appreciate it. Thank you for your help again.