How do I Control de direction of the bullet ?

0 favourites
  • 12 posts
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • I made a simple combat system using the bullet behavior, but it doesn't change direction . What i mean is that when my player is facing right , he shoots right . But when my player is facing left , he still shoots right !

  • Hello,

    Maybe you can post a simple .capx so we can see your implementation.

    However, when you the player shoots you can give the bullet its angle :

    • Spawn bullet at player
    • Set bullet angle to player angle

    Or

    • If player if facing left
    • Set bullet angle to 180

    Else

    • Set bullet angle to 0

    Depending on your type of game. If you use the bullet behavior, setting the angle of object might does not be enough and you'll have to set the bullet behavior angle of motion instead, (if bullet behavior set object angle to angle of motion property is unchecked).

  • Can you please detail more how to do these steps ? Like where i need to click ( Sorry , im new to construct 2 )

  • Of course, when the player shoots (I don't know your implementation, maybe post your project, or a simple one), I imagine you do the action "player => spawn bullet, or system => create object Bullet at Player.X Player.Y", just after this line in the editor your click on "Add action" and "bullet => set angle of motion to Player.Angle".

    In the editor you can quickly retrieve variables (like "Player.Angle" from objects with the little window that opens when you create or edit an action or condition.

    Or if you game is a plateformer, barely the same : spawn bullet, then create a condition "if player is facing left (by testing its angle or animation) => set bullet angle to 180 (left)", create an "else" condition and "set bullet angle to 0"

  • How do i put if player is facing left ? Do i have to go to player or to system ? EDIT : I went to player and system and i didn't find the " facing " option .

  • There is no "facing" condition. You have to check wich animation the player is actually playing if you have one for to go left and one for right.

    Add a condition, select your player, under "animation" select "is playing" and the animation you want. For example, if animation "left" is playing, then shoot left.

    I can make you a little example for these kind of tests.

  • Please make an example then . Im not american so sometimes is hard to understand what you are talking .

  • Did you look in to the scirra examples? You can pick them from the start page in construct 2.

  • Yes , but i didn't found any platform game with a shooting mechanic .

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are plenty examples here https://www.scirra.com/forum/how-do-i-frequently-asked-questions_t63692.

    Here is a little one. I can show you more if you want. Click on the conditions and actions and "back" to see how I've went to it.

    https://www.dropbox.com/s/thov38l6678eyl6/example.capx?dl=0

  • And ther is another. Although Nabu0001 mouse drawing skills are mush better than mine! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    modified Paltformer 4 example

    https://db.tt/dmTVD86P

  • It worked, thanks ! ( And thanks for being patient with me lol )

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