How do I Make the play shoot where he can "See"

Get help using Construct 2

Post » Fri Oct 23, 2015 12:13 am

Hi

I'm making a game where you are a Wizard, trying to shoot fire and ice at the other player/AI. One major problem i have had is the player can shoot behind itself. I need it to only be able to shoot in front of it, or in its "Vision"
* = player
/ or \ = his line of "Vision"
____ = where he cant shoot

__ /
_/
*
_\
__I need something like that. Please help :D

Thanks,
Ian
B
23
S
7
G
1
Posts: 90
Reputation: 2,070

Post » Fri Oct 23, 2015 5:08 am

Okay...i dont really know what the perspective or the movement of you character is.
Can he face different directions, is he stationary and can look only in one direction?

If you character can turn, i would look at the shooter tutorial that comes with construct.
B
20
S
7
G
2
Posts: 58
Reputation: 1,974

Post » Sat Oct 24, 2015 1:26 pm

Thank you for the speedy response! :D

But the player would be able to move up and down, left and right, but he can't turn

He is also only 1/2 of the screen because it is two player game.

Thanks,
Ian
B
23
S
7
G
1
Posts: 90
Reputation: 2,070

Post » Sat Oct 24, 2015 3:14 pm

If you are using a crosshair or something like this to see where you are going to shoot, you can do something like this if we consider the player angle is used as its vision reference :

if angle(player.X, player.Y, crosshair.X, crosshair.Y) is between player.angle -45 and player.angle+45 then shoot.
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Sun Oct 25, 2015 4:35 am

Ok, Since it is on a mobile device, would i just set "Crosshair" behide the background and >On tap gesture>If touch.x > layoutwidth/2 Then set "crosshair" position to touch.x touch.y?

Sorry im really new at this sort of thing
B
23
S
7
G
1
Posts: 90
Reputation: 2,070


Return to How do I....?

Who is online

Users browsing this forum: JohnnySix and 8 guests