8 Directional Shooting

Get help using Construct 2

Post » Mon Oct 31, 2011 9:37 pm

I seem to be having a problem with 8 Directional Shooting,
I have a character that has 8 sets of animations for 8 Directions.
And i have a bullet that needs to shoot in the direction the player is facing.
I've tried rotating the bullet At spawn time to the players angle, but thats not working.

If i set my player to Rotate towards the mouse i can then shoot in 8 directions, but thats not the controls i want.

I know it will be something simple, but my head now hurts....

CapX Heretonycrew2011-10-31 21:38:57
B
40
S
14
G
11
Posts: 243
Reputation: 9,432

Post » Mon Oct 31, 2011 9:59 pm

Hmm, the way you have done it the only option I see is to have a bunch of events under the shooting bit which basically go like "If animation is bottom left, set bullet angle to 45".

But the whole setup seems wrong, you'd want to add animation angles and have the system select them, instead of arrow key combinations. Then you could just read the angle from the sprite.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Mon Oct 31, 2011 10:09 pm

I see but it seems very long winded to shoot in a direction your facing, i thought it would automaticaly shoot in the direction that the sprite it's being spawned from.

And it's the only way i could in my limited knowledge of C2 get all my animations to run.

Maybe instead of having to rotate ALL sprites in every game there should be an arrow that could be added in the sprite editor to just select which way is which. So that the Players and Bullets would just go the way they are facing.
Also with the rotating thing it sometimes creates sprites to be out of alignment when animating.

I do seem to spend alot of time in my games rotating sprites, in the Editor and then on the layout and then again in the events.tonycrew2011-10-31 22:13:20
B
40
S
14
G
11
Posts: 243
Reputation: 9,432

Post » Tue Nov 01, 2011 2:13 am

Ended up setting a variable at the tip of my gun then.


angle(PMerc.X, PMerc.Y, PMerc.ImagePointX("aim"), PMerc.ImagePointY("aim"))

then

angle PMerc.DirectionAngle
B
40
S
14
G
11
Posts: 243
Reputation: 9,432


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 25 guests