Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Field of Vision

Hi everyone,

So basically heres the deal; Im making a portion of my game into this little stealth segment where you have to avoid the lantern carrying guards in the city. Now my question is, how do i make it so that if my character passes within the field of vision of the guard, it displays a messege/gameover/whatever? The "Field of vision i want is 2 or 3 (haven't decided) spaces in FRONT of the guard only...I dont think i would need scripting for this would i, because i prefer eventing.

Thanks in advance  :wink:
 
You can do this with a few variables.

Code:
@>Control Variables: [Guard X] = [Guard]'s Map X
@>Control Variables: [Guard Y] = [Guard]'s Map Y
@>Control Variables: [Player X] = [Player]'s Map X
@>Control Variables: [Player Y] = [Player]'s Map Y

@>Conditional Branch: [Guard] is facing left
  @>Control Variables: [Guard X] -= [Player X]
  @>Conditional Branch: [Guard X] <= 2 or 3
    @>Conditional Branch: [Guard X] >= 1
       @>Show Text: You got caught! Game over.

Do this for all 4 directions (use negative numbers and exchange X with Y), add a "Wait 1 frame", and put the whole code in a Parallel Processing event.

Hope this helped.
 
Thanks, but for some reason its just not working. I tried tweaking it but its not doing what i ask it to. I mean it is working so thats cool, but the distance is all screwed up, like im getting caught when im like 10 units away...I'm sorry im just not too experienced with RMXP. Any ideas?

Thanks for everything!  :thumb:
 
Regi":1vg2zzce said:
You can do this with a few variables.

Code:
@>Control Variables: [Guard X] = [Guard]'s Map X
@>Control Variables: [Guard Y] = [Guard]'s Map Y
@>Control Variables: [Player X] = [Player]'s Map X
@>Control Variables: [Player Y] = [Player]'s Map Y

@>Conditional Branch: [Guard] is facing left
  @>Conditional Branch: [Guard Y] == [Player Y]          ### add this line
    @>Control Variables: [Guard X] -= [Player X]
    @>Conditional Branch: [Guard X] <= 2 or 3
      @>Conditional Branch: [Guard X] >= 1
         @>Show Text: You got caught! Game over.

Do this for all 4 directions (use negative numbers and exchange X with Y), add a "Wait 1 frame", and put the whole code in a Parallel Processing event.

Hope this helped.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top