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

  • 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

    Thanks,

    Ian

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you for the speedy response!

    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

  • 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.

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)