Spawn object towards another with correct angle

  • Hey guys,

    I'm making a game similar to "Space Blaster" demo where an enemy fires a sprite towards the players X,Y co-ordinates. The only difference i am not firing a spherical object but a sort of laser, thus when it flies towards the user its angle is always different which doesn't make it realistic. I need it to spawn with the correct angle facing the user where ever he is and fly at him.

    I tried changing the angle and all but no luck, i think its a math problem were i'm hopeless.

    Here is a sample .capx file explaining better the problem

    dl.dropbox.com/u/13810427/Battle.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The texture of "laser" has to face right.

    Open the image editor, rotate the texture (6� button from the left in the top bar) and your problem is solved.

  • omg you're right, could you explain why it has to face right to work?

  • Because right is equivalent to 0? in C2. (down 90?, left, 180?, up 270?)

  • This might be a good place to mirror a little feature idea back from the CC days that even had a little illustration:

    <img src="http://i244.photobucket.com/albums/gg36/some9000/SidewaysMovement.png" border="0" />

    How about a "default angle" for all the new sprites? For example facing up seems super-intuitive to most human beings, since, you know, we are kinda vertical. So a way to set where the initial angle faces would be really useful. It could be a project-wide setting which you set at project creation, for example. Set it to "up" and suddenly that shmup isn't an exercise in frustrating clockwise turns, but just awesome fun and games.

  • Ohhhh didn't know that. Thanks :)

  • This might be a good place to mirror a little feature idea back from the CC days that even had a little illustration:

    LOL!

    What a great way to visualize how the angles work in C2. I doubt I will ever forget that now. Thanks for that!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)