I am writing a very quick mini game, and I don’t have any vector implementation for it. This is what I have:
local qx = manx
local qy = many
local px = bigenemyx
local py = bigenemyy
local vx = qx - px
local vy = qy - py
local mag = math.sqrt(vx^2 + vy^2)
bigenemyx = bigenemyx + mag * speed * dt
bigenemyy = bigenemyy + mag * speed * dt
bigenemy needs to follow man. bigenemy just disappears off the screen. I’ve rushed the code for this and am (evidently) not experienced with the maths in this, thanks for any help – apologies if I just haven’t thought straight, I haven’t really stuck to “more speed less haste”!
Well, you are using ‘mag’ value in all directions – it is not good. Try