Hi. As the title states, I'm still trying to modify GaryCXJK's Free Movement script so that there is a pause when the player turns, unless they're only turning 45 degrees. When turning from an orthogonal to a diagonal there is no wait, however, when doing the opposite, there is, for some reason. I'm focusing on one diagonal for the moment, but I can never get it to print "Working!". This code should leave only a tiny gap- as in when the player is turning- so that $oldturncheck is equal to the diagonal, and $turncheck is equal to the orthaganal. However, this is never the case instead, and the code never gets inside the 2 || 6 if statement.
Any idea what I'm doing wrong?I would provide the entire script, but the link is down still.
Edit: Got the link. Here it is.
Any idea what I'm doing wrong?
Edit: Got the link. Here it is.
Code:
def interpret_move(step_left = distance_per_frame)
@move_poll = [] if @move_poll.nil?
if @move_poll.size > 0
current_move = @move_poll.shift()
d = current_move[0]
horz = (d - 1) % 3 - 1
vert = 1 - ((d - 1) / 3)
turn_ok = current_move[1]
if $wait_time != nil
if $wait_time <= 30
if turn_ok
set_direction(d)
end
end
end
$oldturncheck = $turncheck
if horz != 0 && vert != 0
$turncheck = [horz, vert] # -1 = left; 1 = down; 1 = right; -1 = up
if horz == 0 && vert == 1
$turncheck = 2
end
if horz == -1 && vert == 0
$turncheck = 4
end
if horz == 1 && vert == 0
$turncheck = 6
end
if horz == 0 && vert == -1
$turncheck = 8
end
if horz == -1 && vert == 1
$turncheck = 1
end
if horz == 1 && vert == 1
$turncheck = 3
end
if horz == -1 && vert == -1
$turncheck = 7
end
if horz == 1 && vert == -1
$turncheck = 9
end
end
case $oldturncheck
when 3;
puts $turncheck
puts horz
puts vert
if $turncheck != 3
puts "!!!!!"
if $turncheck == 2 || $turncheck == 6
if horz == 0 || vert == 0
degrees = 45
puts "Working!"
end
if $turncheck == 4 or $turncheck == 8
degrees = 135
end
if $turncheck == 7
puts "opposite!"
degrees = 180
end
end
end