How to make a spawn actor go to the mouse click position

decaoeudecaoeu PRO Posts: 61
edited June 2012 in Working with GS (Mac)
Guys iam making a game where the may actor, can fire and spawn ˜bullet actor˜, but steady of making these actors only respawn and go to a specified direction, i want to make the bullet to move to the place where i have clicked with the mouse, how can i do that?

Best Answer

  • jckmcgrawjckmcgraw Posts: 647
    edited June 2012 Accepted Answer
    There's a video on the GameSaladCookbook's youtube channel that TSB made that should help.

    EDIT: TSB beat me to it!

Answers

  • decaoeudecaoeu PRO Posts: 61
    Thanks alot guys, this was exactly what i was looking for.
  • FViMaginationFViMagination Member Posts: 89
    i think you can try this:

    1. make 2 Real game.attributes
    2. call them BulletX and BulletY
    3. into MainActor, make a Rule that says that when mouse button is down, it spawn a BulletActor
    4. add 2 Change Attribute behaviors, one changes BulletX to Mouse.Position.X, the other one changes BulletY to Mouse.Position.Y
    5. go into BulletActor and do this:
    interpolate behavior -> Bullet.Position.X to game.BulleyX, (set its duration as you want, 0.5, 0.2, whatever)
    another Interpolate -> Bullet.Position.Y to game.BulletY, (set its duration as you want, 0.5, 0.2, whatever)

    so, wherever you'll tap your finger on the screen, your BulletActor(s) will move to that position.
Sign In or Register to comment.