Hello, I’m not a very experienced programmer, my past experience was writing couple of ios apps and games using Objective-C&SWIFT, I’ve been hearing that LUA is supposed to be a simple and a quick scripting language, I tried the side-scroller tutorial, and the very first tutorial with the frog, but I’m very confused and the lack of auto-complete in the editor certainly is not helping, I don’t know the vmath functions for example, or what parameters they should take, also I can’t distinguish between strings that belong to the system or ones we define ourselves. I’m also finding this “message” system to be confusing, I’m used to simple, classic OOP in communicating between classes, components. So is there a proper website or tutorial that could help me understand Lua better before I dive in here, I also find this function from the first tutorial extremely confusing:
local function handle_geometry_contact(self, normal, distance)
-- project the correction vector onto the contact normal
-- (the correction vector is the 0-vector for the first contact point)
local proj = vmath.dot(self.correction, normal)
-- calculate the compensation we need to make for this contact point
local comp = (distance - proj) * normal
-- add it to the correction vector
self.correction = self.correction + comp
-- apply the compensation to the player character
go.set_position(go.get_position() + comp)
-- check if the normal points enough up to consider the player standing on the ground
-- (0.7 is roughly equal to 45 degrees deviation from pure vertical direction)
if normal.y > 0.7 then
self.ground_contact = true
end
-- project the velocity onto the normal
proj = vmath.dot(self.velocity, normal)
-- if the projection is negative, it means that some of the velocity points towards the contact point
if proj < 0 then
-- remove that component in that case
self.velocity = self.velocity - proj * normal
end
Why are we making all these physics calculation, isn’t there supposed to be a built-in physics engine?!
I hope I’m not being too much of a burden