I am currently experimenting before starting a project. These days I was thinking about how to create an enemy with a basic artificial intelligence: just follow you. Without a pathfinding system
And I was also thinking of creating several instances of that enemy. The problem is that I don't know how I will do it.
Some help?
Help to create enemies
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Leonardo2450
- Prole
- Posts: 15
- Joined: Wed Jul 17, 2019 12:45 am
- Location: Esta xd
Help to create enemies
Last edited by Leonardo2450 on Fri Dec 20, 2019 7:07 pm, edited 1 time in total.
-Leonardo2450-
[DATA EXPUNGED] Argentinian looking for something to do in his spare time.
[DATA EXPUNGED] Argentinian looking for something to do in his spare time.
Re: Help to create enemies
That question is pretty broad. "Follow you" can be as simple as go straight towards you as in Drazzard https://love2d.org/forums/viewtopic.php?f=14&t=80655, or as complex as using a path finding algorithm, which is an advanced topic for which a good understanding of graph theory and recursive functions is required. Could you be more specific?
- Leonardo2450
- Prole
- Posts: 15
- Joined: Wed Jul 17, 2019 12:45 am
- Location: Esta xd
Re: Help to create enemies
Hi, without a pathfinding system like in Drizzard.pgimeno wrote: ↑Fri Dec 20, 2019 4:05 pm That question is pretty broad. "Follow you" can be as simple as go straight towards you as in Drazzard https://love2d.org/forums/viewtopic.php?f=14&t=80655, or as complex as using a path finding algorithm, which is an advanced topic for which a good understanding of graph theory and recursive functions is required. Could you be more specific?
-Leonardo2450-
[DATA EXPUNGED] Argentinian looking for something to do in his spare time.
[DATA EXPUNGED] Argentinian looking for something to do in his spare time.
Re: Help to create enemies
This might give you some ideas.
Best
Best
- Attachments
-
- eatCursor.love
- Simple following the cursor
- (175.93 KiB) Downloaded 204 times
Re: Help to create enemies
To-go pathfinding algorithm is A* (a-star). It's a little complicated but it works great, you don't need to understand it you just need to implement the code without errors. It works great on square and hexagonal grids, but it can also work on a freeform mesh made up of connected dots (navmesh). If your map doesn't have complicated obstacles, you can simply move the object towards the goal and sidestep if it detects obstacles ahead.
- Leonardo2450
- Prole
- Posts: 15
- Joined: Wed Jul 17, 2019 12:45 am
- Location: Esta xd
Re: Help to create enemies
I'm sorry, I'm still new to Lua and I don't quite understand the code of this project. :/
Edit:
Thank you very much, that gave me an idea and I have done it and it worked. As they would say in my country: Sos un capo
-Leonardo2450-
[DATA EXPUNGED] Argentinian looking for something to do in his spare time.
[DATA EXPUNGED] Argentinian looking for something to do in his spare time.
Who is online
Users browsing this forum: No registered users and 16 guests