Please help with classes for npcs

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Imaculata
Party member
Posts: 102
Joined: Mon Aug 10, 2015 2:51 pm

Re: Please help with classes for npcs

Post by Imaculata »

Alright, so I should probably just rename it to "npc", and store the npc's in a different array of their own (and not in bump's world). That would at least make them more easy to access. The player won't be colliding with the npc's directly, nor will the npc's will be colliding with each other. I was thinking of allowing all characters to just move through each other. Because bumping into characters all the time could get annoying, especially if they are in your path.

However, I will need to do some line-of-sight checks. Which means I'll probably be drawing an imaginary line from the feet of an npc, to the feet of the player, and then see if the line collides with any collision tiles. I probably do want to use bump for that. But for that I would still need to add references to the npc's to bump.

Maybe I can simply add an npc to bump when I need to do one of those checks, and then immediately remove it again once I'm done with them. I'm not sure if that would cost a lot of performance, but I don't need to have those npc's in bump all the time.
Last edited by Imaculata on Mon Feb 15, 2016 12:41 pm, edited 1 time in total.
User avatar
pgimeno
Party member
Posts: 3551
Joined: Sun Oct 18, 2015 2:58 pm

Re: Please help with classes for npcs

Post by pgimeno »

For line of sight checking, I'm not sure if this would help: https://www.love2d.org/forums/viewtopic.php?f=5&t=78728
User avatar
Imaculata
Party member
Posts: 102
Joined: Mon Aug 10, 2015 2:51 pm

Re: Please help with classes for npcs

Post by Imaculata »

Ah, thanks. I'll look into that. First I'll see if I can get the npc's to render, and display their names above their heads. Once I've got that working, I'll start doing some line of sight stuff, and try and make their names fade out if they too far away from you, or can't see you.
User avatar
Imaculata
Party member
Posts: 102
Joined: Mon Aug 10, 2015 2:51 pm

Re: Please help with classes for npcs

Post by Imaculata »

Short update. The game now renders npc's, along with their animations, and correctly places their names above their heads if you are within line of sight range. The character graphics are currently just placeholders. Blue rectangles represent men and pink rectangles represent women. Simple arrows show what direction they are facing. Now I can at least tell the npc's apart from one another.

The player has a radius at which he/she becomes visible to npc's. All I'll need to do next, is do an actual line of sight check to see if there are any walls in the way.

Currently the collision does not make any difference between a solid wall, and a table. Obviously a table should not block the line of sight of an npc. So I'll need to upgrade the collision system to take that into account. I do not know how to do that yet. I saw in the documentation for bump that it allows you to filter specific classes of collision objects. But for that you would need to HAVE classes first, I presume.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 57 guests