cancel interpolate problem
![ApplaudApps](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Evening,
I've got a level preview going on where the camera tracks up and down the scene before play starts and I've got a skip button.
What I want to happen is that when the skip button is touched the camera goes immediately to Y position zero and play starts i.e. the preview is cancelled and camera is back at the start position at the bottom of the scene (which is double height)
But what I'm getting is that the first part of the preview interpolate instruction that moves the camera up the scene still completes and then freezes at the top of the scene because the skip part of the program has already happened (you see a brief flash where the camera goes to the zero position and then resumes where the interpolate has got to)
Is there no way to cancel an interpolate mid run? Any workarounds that you can help me with? Thanks in advance. Philip.
I've got a level preview going on where the camera tracks up and down the scene before play starts and I've got a skip button.
What I want to happen is that when the skip button is touched the camera goes immediately to Y position zero and play starts i.e. the preview is cancelled and camera is back at the start position at the bottom of the scene (which is double height)
But what I'm getting is that the first part of the preview interpolate instruction that moves the camera up the scene still completes and then freezes at the top of the scene because the skip part of the program has already happened (you see a brief flash where the camera goes to the zero position and then resumes where the interpolate has got to)
Is there no way to cancel an interpolate mid run? Any workarounds that you can help me with? Thanks in advance. Philip.
Comments
i would add a rule after each interpolate to check to see if "skip" has been pressed. so, when skip is pressed it changes a skip attribute to 1.
then, after the first interpolate, it checks to see if skip=1. if it does, then it jumps right to where you want the camera to be....so, it wouldn't be an instant "skip"...it'd be delayed, but it might be better than nothing.
But....
When you register a press of the skip button, if you interpolate the x and y vaue of the camera, to the x and y value for 0.1 seconds or something, and then do the skip camera interpolate, I think that might work.
If not...it will at least do something different
This worked for me when I had a problem with interpolating the size of something one way, and then back the other way, I had to hard code in this sort of re-set....but like I say, not sure if it's the same process for what you need.
I'll report back if I find a working solution.
So use interpolate on the x and y when the skip button is press and it should circumvent the rest of them from happening. But you will also have to make sure you do something to invalidate the rule that starts the first interpolate.
rule 'skipped' = false {
interpolate cameraY to 640 2.5 seconds
rule cameraY = 640 {
interpolate cameraY to 0 2.5 seconds
}}
otherwise {
interpolate cameraY to 0 0.1 seconds
}
I've also tried a separate rule if skipped = true instead of the otherwise.
What happens is it quickly interpolates to 0 and the continues the first interpolate up to 640 then stops i.e. it cancels after that and doesn't return down.
So the skipped interpolate happens (just like my original change attribute happened) but it doesn't appear to overwrite/cancel the original interpolate, only temporarily interrupt it.
Plus I really wanted to use the easing you get with interpolate.
edit : moveto is instant isnt it rather than an animation? that's why it didn't work.
What do you mean by linear motion?
I added an actor attribute called previewY, constrained the actor.position.Y to previewY, interpolated the previewY value to do the scene preview up and down.
When 'Skip' is touched constrain actor.position.Y to actor.position.Y which cancels the preview interpolate since its no longer following it (even though the original interpolate is still going on)
Works perfectly and no memory issues. Hope this might help someone else.
http://gamesalad.com/game/17982
Search Scene Preview in the gamesalad new tab and you should be able to download it
Take a look at that though its all interpolates no extra constrains or anything which is really good to avoid as many as you can.
___________________________________________________________________________________
GS BubbleBall Template HERE!!
Stacks Level Selection Template HERE!! Now only $20
Expanding Option Menu Template HERE!!
AppSolute Entertainment on iTunes
AppSolute Entertainment on Facebook
Thanks anyway mate!
Thats an odd glitch I think I may actually send that to GameSalad as it should cancel out the interpolate its on and start a new one.
I have 2 actors one shrinking and one growing and GS doesn't register collision until both have interpolated ...aaahhhhh lol
Darren.
Applaud, I was talking about Linear Motion, you can get to the settings for this under the attribute browser. You would drag a change attribute behavior on the actor, and go Self.Motion - Linear Motion. And you have X and Y coordinates to manipulate, but no ease in and ease out like interpolate.
If the interpolate is within a timer with the "run to completion" box unticked then any change in the rules its being run under will cancel the timer instructions including interpolate!!
edit: but only if another interpolate takes it place under a diffent rule/timer combo.
___________________________________________________________________________________
Project Help from Tenrdrmer Click Here
GS BubbleBall Template HERE!!
Stacks Level Selection Template HERE!!
Expanding Option Menu Template HERE!!
Tenrdrmer's Menu # 3 HERE!!
Menu #4 - Level Banners HERE!!
AppSolute Entertainment on Facebook
AppSolute Entertainment on iTunes