bullet behavior help (space game)

Get help using Construct 2

Post » Sun Sep 01, 2013 4:59 pm

the bullet keeps going wrong way i need it to shoot in front of the player sprite it shoots wrong way
https://www.dropbox.com/s/eu1xhqi1z2bpnyt/SpaceGame_.capxcoolabah2013-09-01 17:50:36
B
3
Posts: 4
Reputation: 308

Post » Sun Sep 01, 2013 7:21 pm

That's because your ship is flying backwards! Just kidding. I did it like this (surely there are other ways though): Set bullet's angle "Set angle" parameter to Yes, add a global variable (ShootAngle, for example) which'll determine bullet's shooting angle, change it accordingly when player's moving direction changes. And finally, set the bullet's angle to ShootAngle after the bullet is created.

That ship really is flying backwards, though.
B
10
S
1
Posts: 54
Reputation: 958

Post » Tue Sep 03, 2013 8:32 am

i have tried that and didnt work i dont know what else to do any other ideas ?coolabah2013-09-03 08:34:17
B
3
Posts: 4
Reputation: 308

Post » Tue Sep 03, 2013 8:46 am

You have separate animations for up, down, right, left.

Create a global variable called PlayerShipDir.

Create a series of conditions:

PlayerShip is playing Up, then set PlayerShipDir to "Up"
PlayerShip is playing Down, then set PlayerShipDir to "Down"
PlayerShip is playing Left, then set PlayerShipDir to "Left"
PlayerShip is playing Right, then set PlayerShipDir to "Right"

Then make a sub-event below when space is pressed.
PlayerShipDir = "Up" then set bullet angle of motion to 270
PlayerShipDir = "Down" then set bullet angle of motion to 90
PlayerShipDir = "Left" then set bullet angle of motion to 180
PlayerShipDir = "Right" then set bullet angle of motion to 0

And you should probably fix the problem of the ship flying backward.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234

Post » Tue Sep 03, 2013 9:37 am

I played around with your Capx, fixing a few glitches. I think I fixed to a playable state, but don't save it over your other one, in case I did something you don't like.

https://dl.dropboxusercontent.com/u/85412219/forumposts/FixedSpaceGame.capx

There are Comments with things I did.

Edit: If you'd rather I didn't leave your game source up, let me know and I'll delete it.

In case someone is also looking for similar answers, mainly what I did was change all ships to face right in the Animation editor, because all behaviors expect the front to be to the right, if your sprite isn't it will look funny. (Except the boss ship, which just slides side to side.)
I set the boss bullets to aim at the location of the player, so don't sit still. (I didn't beat him after that.)

I also fixed image points, for example the star animation had a bounce in it due to a misaligned origin point.

And I set it to rotate one ship sprite so it's direction could tell the bullet where to go. (rather than using sprites facing each direction.)
The different animations can still be used, as long as they all face right.
Paradox2013-09-03 09:55:43
B
230
S
62
G
33
Posts: 902
Reputation: 40,319


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests