Incorrect parameter type: expected userdataRobin wrote:That's more like it.
You made a mistake with the variable name. You used zomb, while it should be zombie.
Enemy/AI system {Still need help D:}
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Enemy/AI system
Re: Enemy/AI system
Sorry for double post, but it works now. Just one problem, it spawns it in the top-left corner of the game screen, not even on the map. I also don't know where to begin on making it move.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Enemy/AI system
That's because you set x and y to 0. Set them to something different (for example using math.random, like you wanted) to put the zombies in other positions.
To make them move, change the x and y properties of the zombies in love.update.
To make them move, change the x and y properties of the zombies in love.update.
Help us help you: attach a .love.
Re: Enemy/AI system
I'm sorry, I'm just lost. What are the x and y properties supposed to be? zombie.x and zombie.y don't work, dt.x dt.y, self.x self.y, zombietype.x, zombietype.y, etc.Robin wrote:That's because you set x and y to 0. Set them to something different (for example using math.random, like you wanted) to put the zombies in other positions.
To make them move, change the x and y properties of the zombies in love.update.
Re: Enemy/AI system
It looks like you guess/expect too much without knowing much of how things work. We beginners are lucky that the wiki provides awesome tutorials that guide us through the first steps into the compelling and fun matter of programming with LÖVE:MP6767 wrote:I'm sorry, I'm just lost. What are the x and y properties supposed to be? zombie.x and zombie.y don't work, dt.x dt.y, self.x self.y, zombietype.x, zombietype.y, etc.Robin wrote:That's because you set x and y to 0. Set them to something different (for example using math.random, like you wanted) to put the zombies in other positions.
To make them move, change the x and y properties of the zombies in love.update.
I suggest you do this tutorial step by step: http://love2d.org/wiki/Tutorial:Gridlocked_Player
It is very compact and understandable and something like this should be one of the first things you do.
Sry about my english.
Re: Enemy/AI system
Yeah, that's the tutorial I'm using. I'm making a simple game out of it. I know multiple scripting languages already, but I just started learning Lua a few days ago.
To be a bit more clear, I've looked at pretty much all of the tutorials on tutorials on the Wiki.
To be a bit more clear, I've looked at pretty much all of the tutorials on tutorials on the Wiki.
Re: Enemy/AI system
I'am sorry I just now found your code in one of your replies. Your questions just seemed to be so general that I assumed your a complete beginner like me. Looking at the code I don't really get what your doing actually
Sry about my english.
Re: Enemy/AI system
clickrush wrote:I'am sorry I just now found your code in one of your replies. Your questions just seemed to be so general that I assumed your a complete beginner like me. Looking at the code I don't really get what your doing actually
It's okay
Re: Enemy/AI system
MP6767 wrote: I'm sorry, I'm just lost. What are the x and y properties supposed to be? zombie.x and zombie.y don't work, dt.x dt.y, self.x self.y, zombietype.x, zombietype.y, etc.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Enemy/AI system {Still need help D:}
In love.draw, you loop over the zombies. If you do the same in love.update, you can do
You can use whatever name you like (best make it a clear one, though).
Code: Select all
for i, foo in pairs(zombies) do
foo.x = ....
...
end
Help us help you: attach a .love.
Who is online
Users browsing this forum: Bing [Bot] and 1 guest