Bullet faces wrong direction on button click

Just started using Construct 2? Post your questions here

Post » Fri Oct 13, 2017 9:04 pm

Hi,

I've set my spaceship (with bullet movement) to face in the direction of a planet when i click on the planet. I then click on the 'go' button for the spaceship to move.

When I click this 'go' button, the spaceship starts moving but changes direction to either the centre-left or centre-right far side of the screen (depending whether the planet is on the left or right of screen's centre).

I hope this makes sense. I don't know whether it's a glitch because i'm not using direct keyboard movements for my ship, but button clicks to activate the movement as well as stop.

I've gone over my events and also tried a new order to see if it can fix the problem, but whenever I press the 'go' button the spaceship will always sightly change direction. The only way to fix the direction is to click on the planet again while it's moving.

Thank you for any help
B
7
Posts: 55
Reputation: 389

Post » Sat Oct 14, 2017 1:56 am

I'm guessing you have "Set angle=Yes" in Bullet behavior?
Make sure the image of the ship (when you double-click your sprite) is correctly positioned. It should be horizontal and facing right.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,386
Reputation: 84,399

Post » Sat Oct 14, 2017 3:23 pm

obi554 if you want to move players in direction way you want then try this tutorial and might come up with your own method

https://www.scirra.com/tutorials/5367/a ... t-2/page-1
B
269
S
52
G
16
Posts: 2,045
Reputation: 44,128

Post » Sat Oct 14, 2017 11:19 pm

dop2000 wrote:I'm guessing you have "Set angle=Yes" in Bullet behavior?
Make sure the image of the ship (when you double-click your sprite) is correctly positioned. It should be horizontal and facing right.


Hi,

I have the following code:

1. Planet1 > On click > Bullet > set angle towards Planet1.X, Planet1.Y

This works fine.

2. Go button > On click > Bullet > set speed X

The space ship starts to move, but changes its angle towards the centre of the left/right sides of the screen, and I have to press the Planet1 button again so it can correct it's angle of movement back towards Planet1. It does this same error for all 4 planets.
B
7
Posts: 55
Reputation: 389

Post » Sun Oct 15, 2017 3:24 am

Try setting the speed before you set the angle.
If speed=0, then Bullet-Set Angle action is ignored.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,386
Reputation: 84,399

Post » Thu Oct 19, 2017 8:19 pm

dop2000 wrote:Try setting the speed before you set the angle.
If speed=0, then Bullet-Set Angle action is ignored.


Thanks for your message. How do I set the speed first?
B
7
Posts: 55
Reputation: 389

Post » Fri Oct 20, 2017 2:19 am

So you currently have this:
Planet1 On click -> SpaceShip -> Bullet -> set angle towards Planet1.X, Planet1.Y

Change it to this:
Code: Select all
Planet1 On click -> SpaceShip -> Bullet -> set speed X
                    SpaceShip -> Bullet -> set angle towards Planet1.X, Planet1.Y

Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,386
Reputation: 84,399

Post » Sat Oct 21, 2017 11:27 am

dop2000 wrote:So you currently have this:
Planet1 On click -> SpaceShip -> Bullet -> set angle towards Planet1.X, Planet1.Y

Change it to this:
Code: Select all
Planet1 On click -> SpaceShip -> Bullet -> set speed X
                    SpaceShip -> Bullet -> set angle towards Planet1.X, Planet1.Y



Hiya, thanks.

I'm currently tweaking different parts of my events because there are lots of different actions that are linked in a chain with my ship movement (power, mineral content, temperature etc) so once I've worked out how the chain links i'll test it out and post results on this thread.

Thanks again :D
B
7
Posts: 55
Reputation: 389


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 3 guests