How do I Control de direction of the bullet ?

Get help using Construct 2

Post » Sat Jun 27, 2015 4:32 pm

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 !
B
4
Posts: 12
Reputation: 224

Post » Sat Jun 27, 2015 4:37 pm

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).
B
14
S
4
Posts: 109
Reputation: 1,281

Post » Sat Jun 27, 2015 4:52 pm

Can you please detail more how to do these steps ? Like where i need to click ( Sorry , im new to construct 2 )
B
4
Posts: 12
Reputation: 224

Post » Sat Jun 27, 2015 5:11 pm

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"
B
14
S
4
Posts: 109
Reputation: 1,281

Post » Sat Jun 27, 2015 5:18 pm

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 .
B
4
Posts: 12
Reputation: 224

Post » Sat Jun 27, 2015 7:49 pm

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.
B
14
S
4
Posts: 109
Reputation: 1,281

Post » Sat Jun 27, 2015 8:08 pm

Please make an example then . Im not american so sometimes is hard to understand what you are talking .
B
4
Posts: 12
Reputation: 224

Post » Sat Jun 27, 2015 8:15 pm

Did you look in to the scirra examples? You can pick them from the start page in construct 2.
working on Rally Racing
B
8
S
1
G
2
Posts: 48
Reputation: 1,076

Post » Sat Jun 27, 2015 8:17 pm

Yes , but i didn't found any platform game with a shooting mechanic .
B
4
Posts: 12
Reputation: 224

Post » Sat Jun 27, 2015 8:35 pm

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
B
14
S
4
Posts: 109
Reputation: 1,281

Next

Return to How do I....?

Who is online

Users browsing this forum: evillair and 11 guests