I've really been stumped by this lack of feature.

jweaver911jweaver911 Member Posts: 439
edited November -1 in Working with GS (Mac)
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!

Comments

  • JackBQuickJackBQuick Member Posts: 524
    I'm not sure I understand exactly what you want to do but some areas you might want to explore are:

    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.
  • jweaver911jweaver911 Member Posts: 439
    Yeah. I'm using all of those. I guess I can break it down further.

    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.
  • JackBQuickJackBQuick Member Posts: 524
    How about having just one actor: half of this actor is invisible; the other half is the tongue. The middle of this actor is in the frog's mouth. When this actor stretches, you see the tongue elongate towards the fly; the invisible part also grows in the opposite direction but you don't see it.

    Maybe something like this:

    http://gamesalad.com/forums/topic.php?id=1025#post-5800

    but with the ability to resize as well?
  • jweaver911jweaver911 Member Posts: 439
    Hey... Who said anything about him eating a fly? lol... Anyway, yeah I was hoping for something a little less "work-around-ish." I do appreciate your assistance and time though, so thanks a bunch!

    EDIT: Downloaded that demo, and don't think it helps my situation too much.

    Any other ideas?
  • JackBQuickJackBQuick Member Posts: 524
    Another possibility is to have the tongue positioned offscreen. When the mouse is clicked, the tongue appears using Change Attribute and changing the self.Position.X and self.Position.Y values. You can probably figure out the rest (angle, size).

    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.
  • JackBQuickJackBQuick Member Posts: 524
    I just assumed that it was a fly. However, it would be hilarious if your frog were bringing down birds and low-flying airplanes :)
  • jweaver911jweaver911 Member Posts: 439
    Yeah I don't know... The movement I have now is super fluid and looks good. It's just not located right.
  • jweaver911jweaver911 Member Posts: 439
    I really either want to figure out how to interpolate to the halfway point of the click or just know if its even possible to have the size change from one end of the actor only....

    sorry for the double post.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    check out the magnitude demo under my profile. it shows how to rotate and stretch and actor between two points.

    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.
  • jweaver911jweaver911 Member Posts: 439
    Thanks FMG!

    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.
  • rdcuberdcube Member Posts: 361
    or you can always buy my game: http://gamesalad.com/forums/topic.php?id=5655

    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 ;~)
  • jweaver911jweaver911 Member Posts: 439
    Hey, way to jump to conclusions instead of being helpful. I like the art of your game though. :) And actually I have a few more plans that just the simple "yay, let's eat the flies". It appears that you have gotten the tongue to do pretty much what I want, so why did you say you "gave up?"

    Oh wow. I didn't see FMG's Elasticity demo. Thanks for pointing that out.
  • rdcuberdcube Member Posts: 361
    @jweaver, I didn't meant to jump to conclusions, ur just not specifying exactly what the purpose of the 'tongue' is.

    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 ;~)
  • jweaver911jweaver911 Member Posts: 439
    @rdcube
    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.
  • jweaver911jweaver911 Member Posts: 439
    WOOHOO! I figured it out! With the combination of constraints and interpolations that I already have in place I now have a tongue tip and a tongue "body" that stretches to meet your click! Yes!

    FEELS GOOD!

    Thanks FMG for the tutorials which helped me with my constraints.
Sign In or Register to comment.