Hello all,
I’m fairly new to Lua and programming in general so bear with me.
I’m working on a tower defense game that uses tiles in order to create level maps. I created a toggle button to change the speed of the enemies from 1 block to 2 blocks. However, if the toggle is pressed when an enemy is 1.5 blocks from a turn, it will continue going straight through.
[lua]
local function getDirect( moveArray )
local speedVar
if speedAllowed == true then
speedVar = 2
else
speedVar = 1
end
local direc = moveArray
if direc == “right” then transDirecX = speedVar; transDirecY = 0; rotate = 0
elseif direc == “left” then transDirecX = -speedVar; transDirecY = 0; rotate = -180
elseif direc == “up” then transDirecX = 0; transDirecY = -speedVar; rotate = -90
elseif direc == “down” then transDirecX = 0; transDirecY = speedVar; rotate = 90; end
end
[/lua]
Is there some way I can fix this?
Thanks in advance for any discussion [import]uid: 221639 topic_id: 35745 reply_id: 335745[/import]
