How do I make a person shoot where he is looking?

Get help using Construct 2

Post » Mon May 15, 2017 12:51 pm

basically i want me person to shoot where he is looking and not where the mouse is and i can't figure out how to do that anyone out know?
B
4
Posts: 13
Reputation: 226

Post » Mon May 15, 2017 1:10 pm

You really need to show some starting code
and a screen shot of your game idea.
Eg what is your game? side scroll / top down / isometric
What is your control idea?
What is your character mechanic. Separate Gun / Body / Head
etc

Basically though the angle of your character , or where your character is looking, will be (or can be) defined
and you just need to use that angle to set the bullet angle of motion when firing
...
B
42
S
21
G
7
Posts: 260
Reputation: 7,683

Post » Mon May 15, 2017 1:30 pm

it is a top down game with 8 directions i want him to throw torches but i had to make so you throw it where the mouse is on screen but i don't like that so i wanted to know if there was a way to make is so he throws it where he is looking.
B
4
Posts: 13
Reputation: 226

Post » Mon May 15, 2017 2:05 pm

of course there is...you can pretty much do anything you can think of with Construct

in this case Just set the angle of torch fire based on the 8 direction

eg

right = set bullet angle motion 0
up right = set bullet angle motion 45
up = set bullet angle motion 90
etc
(ps for the down directions use negative angles eg down = -90 deg
...
B
42
S
21
G
7
Posts: 260
Reputation: 7,683


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], Lancifer, newt and 14 guests