interpolate size up and back down

hi,
I need to change the size of an actors width to a smaller size then back to its original within a small amount of time.
Ive tried this...
when attribute is true
interpolate width to 50
(then underneath)
Timer after 0.2, interpolate width to 134, run to completion
should this work because it is not
I need to change the size of an actors width to a smaller size then back to its original within a small amount of time.
Ive tried this...
when attribute is true
interpolate width to 50
(then underneath)
Timer after 0.2, interpolate width to 134, run to completion
should this work because it is not

Comments
when you say 'then underneath' do you mean in the otherwise box?
if one interpolate behavior is active and another starts, the second one just cancels and will only work once the first is over.
so if its changing width to 50 in 0.3 seconds, and you've set it to interpolate back sooner than that - problem. so try delaying the timer (after 0.2secs to a number greater then the duration for the first interp)
if that still causes you a problem then it seems there is an issue with the attribute turning on - and make sure you turn the attribute back off
not sure i understand what you mean.
so..
Interpolate to smaller width.
otherwise
interpolate back to normal width.
Where shall I put the change attribute to false?
thanks
Boolean att. called Pulse, or whatever
Rule: When Att. scene.Pulse is false
Interpolate self.Size.Width to 50 Duration: 1 second?
Timer After 1 second
Change attribute scene.Pulse to true
Rule: When Att. scene.Pulse is true
Timer: After 0.2 seconds
Interpolate self.Size.Width to 134 Duration: 1 second?
Timer After 1.2 second
Change attribute scene.Pulse to false.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
So in the button
When touch is pressed
--Change game.attribute to true
--Timer After 0.2 Run to Completion Checked
----Change attribute game.attribute to false
Then in your actor
When Game.attribute is true
--Interpolate width to 50 Duration 0.5
Otherwise
--interpolate width to 134 duration 0.5
As long as your second interpolate does not finish running before the first you will not having any issues. So it would be best to have it change at the same speed both directions. That way the first one is always going to be done first. Also I feel the otherwise way is better that multiple rules because it reduces the amount of processor being used to read the rules.
___________________________________________________________________________________
TEMPLATES AND PROJECT HELP BY TENRDRMER. CLICK HERE!!!
AppSolute Entertainment on Facebook
AppSolute Entertainment on iTunes
probably should be same as the duration?
--Interpolate width to 50 Duration 0.5
Otherwise
--interpolate width to 134 duration 0.5
timer .5
change self.width to (old amount)
The image will shrink.
I use this all the time, when I have one image swap for on of different size, I add a size change for the new image etc.. works great
All the advice is correct as I tested it on a clean project.. but in my game there is quite a lot going on so it is still not working correctly at the moment.
basically, I have a jump button that when pressed, I change jump to true (with a timer of 0.5secs because I don't want the character to be able to jump again until he hits the ground)
It is the jump attribute that I have triggering the object (which is the characters shadow) to move so I guess that is causing the problem?
Do I just make a new attribute?
Have your jump set up like this:
in the jump button youll have your rules when touch is pressed change jump attirubte to true, then in the otherwise section of that rule put a change attribute changing attirubte jump to false
then in the player have a rule when attirubte jump = true AND when actor collides with ground
change attribute self motion linear velocity y to 300
use that for your jump.
then do what Tendrmer said for your size interpolate
When attribute jump is true
--Interpolate attirubte self width to 50, Duration 0.5
then in the Otherwise section of that rule
-- put a interpolate behavior interpolating width to 134, duration 0.5
Here is a video so you can see what I am talking about as a reference.
Please note: I am not trying any guerilla advertising.
I wanted to make my brain grow and shrink to have a "pulse"
For this I did.
>Rule: If size.width <= 161
>>change size.width to 180
>>change size.height to 160
>Rule: If size.width >= 179
>>change size.width to 160
>>change size.height to 140
But then I ran into a problem Interpolate stopped my actor from recognizing a collide (yes it was moveable)
From there I had two options.
1) constrain a invisible actor with static size 170x150 to its position
2) interpolate two attributes WIDTH and HEIGHT, then constrain self.width to WIDTH and so on
I hope this might become helpful. I read what you were doing and this seemed to relate.
EDIT: I guess this might count as a warning post. If you jump, and while you are jumping you are interpolating size; anything that you want the actor to collide with will not until interpolate is
off.