How to make an actor move to a mouse click then back to start point?

jweaver911jweaver911 Member Posts: 439
edited November -1 in Working with GS (Mac)
I have this problem I'm trying to solve and would greatly appreciate it if someone could point me in the right direction.

I need to get a spawned actor to move to a click then almost immediately move back to its start point. I guess the closest example would be something like a hookshot or boomerang.

I'm still pretty new and I understand this is a pretty hefty concept, but once I figure this out, the rest will fall together for my game. It's going to be a kids/educational game.

Thanks!

Comments

  • KamazarKamazar Member Posts: 287
    Pretty sure you can fill in the steps in between, but here's the gist of it.

    If mouse button is down and is outside actor.
    Move toward mouse X and Y.

    If mouse is up, move toward pre-determined X and Y.

    Or if you don't want to click again, set up a timer.
  • jweaver911jweaver911 Member Posts: 439
    Oh boy... It's always easier logic than you'd think. Thanks for the help guys! I'm in the middle of updating my SDK. So when that's done I'll try it out :)

    I really appreciate the effort in typing all of those examples out.
  • jweaver911jweaver911 Member Posts: 439
    Hey Guys... This works great. However I'm now running into another issue regarding click intervals. I'm trying to limit it to 1 click every .75 sec so that you can click spam and jack up the interpolation i have going on.

    So I created a clickmanager game attrib (type integer value 1)

    and a rule that is basically is like

    on mouse down
    timer (for .75 sec)
    change attribute clickmanager value 0

    otherwise clickmanager value 1

    and on my actual interpolation action i have the rule say:

    Conditions ALL
    on mouse down
    game.clickmanager = 1
    ...Do stuff....

    ======================

    this isn't working for some reason. its still registering clicks even before that timer is up.

    Any ideas? How do you guys manage these scenarios?
Sign In or Register to comment.