Changing actors width one specific direction?
Elfizm
Member Posts: 489
Hello
How would I go about having a rule that changes the length of an actor but only increase in one direction.
I have the a rule called number.
When it is equal to 1 the actor needs to change it's width to 500 but only increase towards the right. Thanks
How would I go about having a rule that changes the length of an actor but only increase in one direction.
I have the a rule called number.
When it is equal to 1 the actor needs to change it's width to 500 but only increase towards the right. Thanks
Comments
So to change an actor from 250 wide to 500 wide - and those extra 250 pixels of width only want to be added onto the right - would be achieved by doing the following . . .
Change width from 250 to 500
Change position X from current position to current position + 125
Or to codify it a little more: any growth in width value needs to have half of that value added to the actor's X position.
Yeah that was my first experiment but i found it like a work around and was hoping there was a formula that could easily be used.
In my line jumper clone game I have the line platform increase only on one side but it's based on magnitude self position and touch position of y and x. But in this game I don't have a touch value, I just need it to increase to a certain point.
Thanks for the answer though
But if there is a forumla I am all ears.
The formula is in my post, as the actor becomes wider add half of that additional width onto the x position.
Yes you do but it requires two rules to complete, which in away is fine but was hoping for one rule,
It also gets messy because I am currently doing it the same way you said and need attributes into it because the size depends on the users input. So there isn't any set size limit. Which also means I need to record the distance and minus if from current position ect. Alot of messying around that could be replaced by a forumla that makes the actor increase to what ever size needed in one way. That is if there such forumla or rule.
Constrain Attribute: self.Position.X To: 100 + self.Size.Width /2
[Edit] Yes, that's essentially the rule for the x position in this scenario, coupled with a rule for the width gives us the solution.
Well I am not sure how to put that into content with the following:
interpolate width to 600 in 1 second.
But my actor x position is not a set value. It changes and I can not have it go self.position ect because logic tells me that won't work.
So then from my guess is that I will need a way to somehow know a fraction of a second before the event happens to record it's initial position and use that in forumla. But then things get complicated because there is other variables that affects the actor as well and it's x position. Which is why I thought I might ask for a way to make it increase one way without messing with the x position being a major variable. I know either way it's going to change the x value but I don't want it to be based on the x position.
But thank you for your help. I think I may need to rethink how I want this to happen and work around it.