Spawning "constrained" yet moving actors (how to?)
Alright, not sure if I am running into a limitation here. I have played with the constrain attributes a while back for making actors move up/down left/right circle etc, but since they are being "constrained", placing a move function is a no-go. What other method could I use to say, spawn an actor and have them travel in a given direction along with a specific movement live a bobbing or circular motion? Seems that GS has to collect that position and without a X or Y constrain how is it going to be able to know what the limitations of travel are? Is there a way to tell it to move 20 pix up and down with a move behavior so I could have these fellows spawn or be manually placed randomly?
I will dream about this in my sleep tonight now doubt.
I will dream about this in my sleep tonight now doubt.
Comments
To make the following techniques flexible enough that they work for multiple directions of core movement would take some more programming, but hopefully it gives you a direction. Even if you don't use trig, the basic idea is that if you use constrains to control movement, you have to feed the entire formula for movement into those constrains, figuring in the variables that create waggling, etc. Alternately, use a second constrain which takes the core constrain and modifies it with wave or waggling motions.
The trouble with using wave motion and constrains AND multi-directional movement is that if your character suddenly turns a corner, it will probably 'teleport' at the moment it does. Unless you limit corner-turning to moments when the trig functions are returning a 0 (ie not modifying movement)... Hey, I just programmed my own solution to a problem I've been thinking about out aloud!
Anyway, trig stuff coming up.
Go here: http://web.archive.org/web/20101201124532/http://gamesalad.com/wiki/interface_reference:expression_editor
Look under sin and cos and you'll find examples with graphics and even maybe demos.
You could have a constrain to move your actor up and down and a 'move' to move it left to right, is that the kind of thing you are after ?
@Tynan yup, Just like that. Seems simple enough but I'm overlooking something :-??
Here is a actor moving left to right with:
Move - Direction 0° - Speed 200
And moving Up and Down with:
Constrain Y to 50*cos( self.Time *400)+384
(I've stuck a 'trail' on the actor so you can see the path the above rules make it follow).
You can do that with a couple of constraints on actor B (one for X, one for Y)
And then simply get actor A to spawn actor B . . . . . ?
Let me chuck something together . . .
Rule on actor A (the one that spawns actor
Rule on actor B (the one that wobbles into the scene)
Result:
Aaaaah! I see what I did wrong now. I had the order inside the constrain in the wrong format.
Sorry if I was not clear, looooong day and my brain was sizzling.
@Tynan Yup, just like that!
Big thanks to both of you!
=D>
I just came back to resource what he had put into this discussion and now Tynan has disappeared? Strange things are afoot at the Circle K.
Ughhh...and I was just getting back to work on this part too.....
*Edit. Alright I got it via cache, so all is good.
sad day for us all
and why were all those wonderful posts and demoLinks removed form our members' Forum?