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.

Total newb with desire to learn

first off, you guys have great tutorials here, ive learned more here than i have anywhere else.

i wasnt sure where to post this so it might need to be moved

im trying to create an event where an npc walks towards the player once the player is in sight (not behind or to the side, but in front).  then return to his post after the player has moved away.  i need a 5-6 tile distance.  i would also like to make it so that the player cannot pass until certian conditions have been met.

this is for the opening scene of my game.  the player is in a field and the only way to pass is to go past the npc.  the npc tells her she cant leave until she has finished her harvest.

if someone could point me in the direction of a tutorial for this it will be greatly appriciated.

thanks a bunch!
 
You could simply make events in a 5-6 tile radius around your NPC. When the player steps on one of those events, you make the NPC move towards your player. You can use "wait for move's completion" to stop the player from moving on while the NPC moves towards you, and then move the player outside of the radius once you've done what you need to.

If you want more advanced options, there's also a script somewhere out there that creates event "sight", try looking for it in the script analysis section
 
As long as you only have one NPC with this sight, you could make a Parallel Process event that will check if player.x == whatever x the npc is on and if play.y > than npc's y and player.y < npc's y + 5 or 6. This is easier than making 5 or 6 events, but it can also create problems if you do too many of these at once.
 

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