give_angle = @g_amm.angle
if give_angle > 360
give_angle = (give_angle-360)
elsif give_angle < 0
give_angle = (give_angle+360)
end
@g_amm.angle = give_angle
if true#子弹之自动向前移动#Kboard.keyb($R_Key_NUMPAD8)
pc90d = (@g_amm.angle%90).to_i
zy90d = (@g_amm.angle/90).to_i
pc90 = @g_amm.angle%90
#0~90度(包含)360
if @g_amm.angle >= 0 and @g_amm.angle <=90
if @g_amm.angle == 0
speedx = @speed
speedy = 0
end
if @g_amm.angle == 90
speedy = @speed
speedx = 0
end
if @g_amm.angle != 0 and @g_amm.angle !=90
downangle = 90- pc90
speedx = Math.cos(pc90*Math::PI/180.0)*@speed
speedy = Math.cos(downangle*Math::PI/180.0)*@speed
end
@suz_x +=speedx
@suz_y -=speedy
end
#90度并合发散
####test
if @g_amm.angle == 180
speedy = 0
speedx = @speed
@suz_x -=speedx
#return
end
if @g_amm.angle == 270
speedy = @speed
speedx = 0
@suz_y +=speedy
#return
end
if @g_amm.angle == 360 #or @g_amm.angle == 0
speedy = 0
speedx = @speed
@suz_x +=speedx
#return
end
####
#91~180度
if pc90d >=1 and pc90d <=90 and zy90d == 1 or @g_amm.angle == 91.0
if pc90d != 1 and pc90d !=90 or @g_amm.angle == 91.0
downangle = 90- pc90#@g_amm.angle
speedx = Math.cos(downangle*Math::PI/180.0)*@speed
speedy = Math.cos(pc90*Math::PI/180.0)*@speed
end
@suz_x -=speedx
@suz_y -=speedy
end
#181~270度
if pc90d >=1 and pc90d <=90 and zy90d == 2 or @g_amm.angle == 181.0
if pc90d != 1 and pc90d !=90 or @g_amm.angle == 181.0
downangle = 90- pc90
speedx = Math.cos(pc90*Math::PI/180.0)*@speed
speedy = Math.cos(downangle*Math::PI/180.0)*@speed
end
@suz_x -=speedx
@suz_y +=speedy
end
#270~359度
if pc90d >=1 and pc90d <=90 and zy90d == 3 or @g_amm.angle == 271.0
if pc90d != 1 and pc90d !=90 or @g_amm.angle == 271.0
downangle = 90- pc90
speedx = Math.cos(downangle*Math::PI/180.0)*@speed
speedy = Math.cos(pc90*Math::PI/180.0)*@speed
end
@suz_x +=speedx
@suz_y +=speedy
end
#,
##{(@g_amm.angle%90).to_i},#{(@g_amo.angle/90).to_i}
# 提示xy速度,以及角度
#pst "x速度#{speedx},y速度#{speedy},角度#{@g_amm.angle} "
end
#向前行走(使用變量來制定小數点,sprite,x,y不支持小數點)
@runed_long += @speed#b
end #def