How to create a mouse targeting system?

svnsvn Member Posts: 445
edited November -1 in Working with GS (Mac)
I need to make a mouse targeting system so my player can shoot stuff at the direction of the onscreen cursor. One idea I have is: to create an actor whose position is always at the cursor. Then, when the player shoots, the bullet will be programmed to move toward the actor. But once it reaches the actor, it stopos moving. I got this far; now how do I keep it going in the same trajectory?
Also, how can I make some of my bullet/grenade actors to move in an arc?

Comments

  • svnsvn Member Posts: 445
    svn said:
    I'm trying to make a mouse targeting system. I've been spending time working on it, but it acts crazily: My bullet only appears where the cursor is, even though I have a rule telling it to spawn where the actor is. And once it spawns, it moves backwards, not even a nudge toward my mouse. What am I doing wrong? Or rather, what do I need to do right?

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    your on the right track, when you shoot have the bullet move towards the cursor. But dont use move or anything like that

    use change velocity and in the direction open up the expression editor and do vectorToAngle(self.position.x-mouse.position.x,self.position.y-mouse.position.y)

    edit: tshirt beat me with a video ;) so just follow that
Sign In or Register to comment.