Eye ball follow Mouse position looks like 3 eyed Fish from "Simsons"
Ok, So I have a little "Flappy bird" like animated character that can be moved with a mouse click with Interpolation.
When attribute game.mouse.button is true
Change attribute:game .clickX to game.mouse .positonX
Change attribute:game .clickY to game.mouse .positonY
Interpolate attribute:self.position.X to game.clickX
Interpolate attribute:self.position.Y to game.clickY
And then I have my animations set up...
I have no gravity (accelerate) setup it's not like a side scrolling game.
In a previous post I asked for help with giving the little bird some random movements to make it more life-like and several of you were gracious enough to chime in and help, Thanks. (Socks, tatting,Braydon, et. all).
http://forums.gamesalad.com/discussion/76466/looking-for-random-hummingbird-type-movement#latest
I had failed to mention that I gave the bird 2 eye balls that are constrained to an X,Y position on the bird and rotate to position following game mouse position X, Y.
Now, with the random (humming bird) movements when the bird completes its movement to where the mouse has been clicked the eyeballs (as one would expect) jump all over the place looking much like the 3 eyed fish from the Simpsons. My kids think this is hilarious, but it was not quite what I was going for.
I know that I need to drop the code that is creating the random movements to the bird into the eye balls as well. I'm thinking in a constrain attribute self.position.X and Y to scene.background.player.positionX and Y...and here maybe drop in+ the attributes used on the bird position to give random movements.
I've tried it several ways now and it's getting all messed up. I'm sure there is much more going on than I'm hip to. So to be clear my question is how can I drop the random movements that I have on the bird on to the eyeballs so that they move with the bird and stay where they should?
Comments
No need to duplicate the code, just constrain the eyes to the main character.
Example file (now in post below)
Example file attached.
. . . . . . . . .
Also, I made tool for this exact purpose, check it out here:
https://forums.gamesalad.com/discussion/75220/fast-constrain-linkmachine-v2
Oh man, that is cool! Just what I was looking for. I will get in to it and make sure I understand it , so's I can impress the kids. Previous post was awesome can't wait to try it out!
Thank you @Socks !
Big Smile Games Play Happy!
Check out our other GameSalad exclusives.
Weird ?