Topic was automatically imported from the old Question2Answer platform.
Asked By
LAzyAusGamer
New to development and I know I am jumping way off the deep end, however looking for sources or examples of NPC AI where NPC has 3 attributes HP, Food and Water. Subject to level of each AI will source to fix their need. E.G eat berries/kill chicken, find water etc. does something like this exists in Godot?
Me too not sure how to implement, but something you can try:
Create a Timer to the NPC say 5 secs,
every time the timer times out, the NPC will check for its unmet attributes (you may prioritise or randomise) and select the unmet need.
you can create an array/dictionary of Vectors where each source is
when finalized you can write below code for movement,
func _process(delta):
var speed = 10
if source.position.x > position.x :
position.x += speed * delta
if source.position.x < position.x :
position.x -= speed * delta
if source.position.y > position.y :
position.y += speed * delta
if source.position.y < position.y :
position.y -= speed * delta
Hope it helps. Let me know if you have more questions.
Thank you for your input and especially the movement code, I guess I have a lot of research ahead of me.
LAzyAusGamer | 2021-08-22 16:07
I suggest narrowing down your question by explaining what exactly your NPC or what type your came is say 2D Platformer, 3D, Top Down etc. the code words for top down.