Help to create enemies

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.
Post Reply
User avatar
Leonardo2450
Prole
Posts: 15
Joined: Wed Jul 17, 2019 12:45 am
Location: Esta xd

Help to create enemies

Post by Leonardo2450 »

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?
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. :awesome:
User avatar
pgimeno
Party member
Posts: 3672
Joined: Sun Oct 18, 2015 2:58 pm

Re: Help to create enemies

Post by pgimeno »

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?
User avatar
Leonardo2450
Prole
Posts: 15
Joined: Wed Jul 17, 2019 12:45 am
Location: Esta xd

Re: Help to create enemies

Post by Leonardo2450 »

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?
Hi, without a pathfinding system like in Drizzard.
-Leonardo2450-
[DATA EXPUNGED] Argentinian looking for something to do in his spare time. :awesome:
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: Help to create enemies

Post by Ref »

This might give you some ideas.
Best
Attachments
eatCursor.love
Simple following the cursor
(175.93 KiB) Downloaded 204 times
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Help to create enemies

Post by raidho36 »

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.
User avatar
Leonardo2450
Prole
Posts: 15
Joined: Wed Jul 17, 2019 12:45 am
Location: Esta xd

Re: Help to create enemies

Post by Leonardo2450 »

Ref wrote: Fri Dec 20, 2019 7:25 pm This might give you some ideas.
Best
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. :awesome:
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests