Something that's confusing me in goature's tutorial
Posted: Tue Aug 04, 2015 1:43 am
Hey all. I was here briefly about a year ago, and now I'm trying to get back into game making. Last time I used josefnpat's tutorial to learn and it was great, but this time as I try to refresh my memory I decided to use a different tutorial so I went with goature. It's great, but there's something I'm confused about. It's probably silly, but I'd rather have everything clear in my head than go on unsure.
Anyway, I just finished part 10 - Hitboxes (https://www.youtube.com/watch?v=POVQBI9 ... B05A624D91) and everything works fine. When I click the zeppelin, the console says "Hit!". The thing is after I finish each part I like to go through the "path" of the code to make sure I understood what happened.
In this video, he created in main.lua which basically detects collision. It checks if a certain position is inside boundaries. Then, in entities.lua, inside of , he calls insideBox(), and it works.
What I don't understand is how I was able to call insideBox() from another file, namely entities.lua. Now, main.lua does contain the line inside of love.load(). To my understanding, that means that I could call functions from entities.lua in main.lua. Not the opposite. entities.lua isn't requiring anything. How is it that I'm able to access that function?
I suspect there's something about the lua language that I'm missing here.. Could anyone point me in the right direction? When I search for this, I keep running into questions from people who are getting errors and not being able to call a function from a different file. Not my case.
Anyway, I just finished part 10 - Hitboxes (https://www.youtube.com/watch?v=POVQBI9 ... B05A624D91) and everything works fine. When I click the zeppelin, the console says "Hit!". The thing is after I finish each part I like to go through the "path" of the code to make sure I understood what happened.
In this video, he created
Code: Select all
function insideBox()
Code: Select all
function ents.shoot()
What I don't understand is how I was able to call insideBox() from another file, namely entities.lua. Now, main.lua does contain the line
Code: Select all
require("entities")
I suspect there's something about the lua language that I'm missing here.. Could anyone point me in the right direction? When I search for this, I keep running into questions from people who are getting errors and not being able to call a function from a different file. Not my case.