I've really been stumped by this lack of feature.
jweaver911
Member Posts: 439
I've searched the forums over for a solution but I can't find one that fits my problem 100%.
I have an actor that has its size/length defined by the difference between a mouse click and a start point(set of coordinates). So the size will grow more depending on how close/far the click is. Easy enough. Now I've seen people constrain these types of size changes so that the "growth" doesn't come out of the center and go in both directions. (i.e. power bar that only moves one way) however, my problem is that my actor also rotates to the direction of the mouse click. I don't understand why GS doesn't just have a feature where you can choose a left,center,right option for where the self.size change takes off from. Since I have my actor rotate, I can't seem to constrain it proplerly.
Now I've come up with a theoretical solution but can't seem to find the syntax to implement it. If I can tell my actor to move halfway to the mouseclick as it's interpolating in size, then it will have the same effect of growing only in that direction. But I have not been able to figure out how to get a halfway point to my mouse click(from the start point) and have the actor interpolate to that halfway point. I'm hoping I'm making this harder than it needs to be, lol.
Any help would be greatly appreciated!
I have an actor that has its size/length defined by the difference between a mouse click and a start point(set of coordinates). So the size will grow more depending on how close/far the click is. Easy enough. Now I've seen people constrain these types of size changes so that the "growth" doesn't come out of the center and go in both directions. (i.e. power bar that only moves one way) however, my problem is that my actor also rotates to the direction of the mouse click. I don't understand why GS doesn't just have a feature where you can choose a left,center,right option for where the self.size change takes off from. Since I have my actor rotate, I can't seem to constrain it proplerly.
Now I've come up with a theoretical solution but can't seem to find the syntax to implement it. If I can tell my actor to move halfway to the mouseclick as it's interpolating in size, then it will have the same effect of growing only in that direction. But I have not been able to figure out how to get a halfway point to my mouse click(from the start point) and have the actor interpolate to that halfway point. I'm hoping I'm making this harder than it needs to be, lol.
Any help would be greatly appreciated!
Comments
In the Interpolate behaviour, use self.size.width and self.size.height to change the size of your actor.
Use magnitude to determine the distance between the mouse click and the starting point.
Use vectorToAngle to determine the angle between the mouse click and the starting point.
Use the Rotate to Angle behavior to rotate your actor to the mouse click; or use self.Rotation within Interpolate.
You can find out more information about these topics by clicking on the magnifying glass icon in the top right corner of GameSalad.com webpages and entering your search terms in the box that appears. Or, you can continue to post in this forum topic and I -- or another member -- will try to help you the best we can.
I agree with you: sometimes, finding the right syntax is half the battle.
I'm creating a stationary frog that shoots his tongue out to anywhere that you click.
I have two actors to make up the tongue: a round tip, and a square.
The tip i have interpolating movement to the mouse click and back after the click is up.
in doing this I have gathered the angle which rotates the tongue square that makes up the body to align with the tongue tip's new location. However my problem lies in the interpolation of the self.Size of that tongue body square. I can make it interpolate to the size=click distance. Which is what I need, but since GS makes size adjustments based off of the center of the actor this is unacceptable. The size change gets split in half both directions.
So my solution was to make the size interpolation of the square(tongue body) occur as it's moving toward the tongue tip circle...thus bridging the gap between the two as the size is changing.
Does this make sense? I hope so. I don't quite understand how to make this occur though because I can't figure out how to make the tonguebody square interpolate to a halfway point while still retaining its original angle.
See Screenshot below to see what I'm avoiding.
http://img690.imageshack.us/img690/9291/screenshot20100418at753.png
See the center of the tongue's body is centered on the frog's mouth. And that dot to the right is the tip I was referring to earlier. I intend for the tongue's body to chase the tip so it looks like one object moving in unison.
Maybe something like this:
http://gamesalad.com/forums/topic.php?id=1025#post-5800
but with the ability to resize as well?
EDIT: Downloaded that demo, and don't think it helps my situation too much.
Any other ideas?
This would, however, have the effect of having the tongue suddenly appear full-sized rather than the player seeing it grow towards the target (which might not be so bad).
Glad to help. Best of luck on your game.
sorry for the double post.
you cannot change the anchor point of an actor. it is only from the center.
you cannot change just one side of an actor. you have to move it as well.
Wow.. That's a pretty complex demo. Not sure I follow all of it. I really only need to know how to make that path show up between the two points at the rotation that I already have specified.... I have the magnitude thing complete.
I've literally been trying to figure this out for the past several hours. I'm about spent for the evening. Maybe I'll try again tomorrow.
I had it working to some extent. however it took two clicks for the everything to line up properly. If it would have worked on the first click then I could move on.
I tried doing what you wanted to do for mine, but found it confusing and kinda pointless since a lot of the same 'frog games' that are on the apps store had the same functionality, I tried to give it a different twist to the whole point and shoot.
But then again, a little competition doesn't hurt anybody, right?
Good luck, and if you figure it out, please share the code ;~)
Oh wow. I didn't see FMG's Elasticity demo. Thanks for pointing that out.
I guess I indirectly helped out by mentioning the FMG elasticity demo on my post, huh?
and to be honest, I did just that "yay, let's eat the flies"...but wanted something a bit different compared to what's currently on the app store with the 'tap and point scenario' or what Synthesis might say, 'taptard'.
thanks for the compliments on the frog, I'm not a designer, but am trying...I like yours too ;0)
Really hoping to see ur complete published game ;~)
No worries man. I was just fighting feisty with feisty.
Yeah You did actually help by leading me on to that tutorial, so thanks! I like that term "taptard" by the way. That's great. I'm trying to avoid that. And with what I have in mind, I think I should be able to.
At the rate this is going.. It might be another month or so before completion. Here's to hoping I can get this figured out and move on to the next stage.
FEELS GOOD!
Thanks FMG for the tutorials which helped me with my constraints.