0 Favourites

Mouse aim indicator HELP

  • sooo i am trying to make an aim system for a platformer that shots only in 8 directions towerfall style i want it to be when left mouse button is down show an aim arrow indicator and when mouse button is released shot at that direction . what i don't know how to do is how to test if mouse courser is between 2 angles for a certain object (playerSprite)

  • I don't know how to explain it so I made a capx.

    You can adapt it to your game, ask me if you don't understand.

    Dropbox link

    (There was a mistake in the first one, it's 135 degrees instead of 145 degrees.)

  • oh dang i cant open it cuz i didn't update construct 2 and i am afraid it would ruin my game . will it ?

  • If your game isn't a complicated giant mess, you can update construct 2 without worries.

  • ok a new question can you tell me when i add the condition of is withen angle .the question is withen angle in relation to what ? i am very confused if there is an angle there should be a center for that angle and i dont understand that condition very well can you explain it panda-kun ?

  • ok a new question can you tell me when i add the condition of is withen angle .the question is withen angle in relation to what ? i am very confused if there is an angle there should be a center for that angle and i dont understand that condition very well can you explain it panda-kun ?

    sagerx the origin of the angle is the origin of the object used in the events. (in the example it's Splayer)

    It's used in relation with the mouse cursor. (in the example mouse cursor=Sscope)

    This picture can help you to understand how it works, the center is the origin of the object you use as a reference in the events. (Splayer in the example)

    If you click below the object origin (X is the same but Y is bigger) the angle is 270°.

    If you click top right of the object origin (X is bigger, Y is lesser) the angle is 45°.

    etc...

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • thx and sorry for being an annoyance but can you show me an example for the event ? to be 100% certain that i understand

  • can you show me an example for the event ? to be 100% certain that i understand

    he example is the capx Dropbox link I have made earlier.

    There are events checking the mouse cursor position(Sscope) compared to the origin of the Player(Splayer) then it sets the bullet angle.

    It's not just "one" event.

  • ok i see the example ,,,,what is GVnumber ?

  • The red or the blue are GVnumber. (it's a variable made to create a space to click with the cursor, not an angle)

    If you set GVnumber to 0, you won't be able to shoot up right left or down.

    If you set GVnumber to 80, you will only be able to shoot up right left or down.

    You can play with it to see the differences, you can scale it to your object size (the example uses a 40x40pixels object)

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