def button_zoom(sprite,x,y,k=1) if sprite.x != x sprite.x = sprite.x < x ? sprite.x += 1 : sprite.x -= 1 end if sprite.y != y sprite.y = sprite.y < y ? sprite.y += 1 : sprite.y -= 1 end if sprite.zoom_x != k sprite.zoom_x = sprite.zoom_x < k ? sprite.zoom_x += 0.01 : sprite.zoom_x -= 0.01 end if sprite.zoom_y != k sprite.zoom_y = sprite.zoom_y < k ? sprite.zoom_y += 0.01 : sprite.zoom_y -= 0.01 end end def slidefx if $stopmove == 1 case @command_window.index when 0 button_zoom(@sprite_enter,140,140) button_zoom(@sprite_save,150,200,0.8) button_zoom(@sprite_exit,160,250,0.8) @sprite_index.x = 140 @sprite_index.y = 140 when 1 button_zoom(@sprite_enter,140,150,0.8) button_zoom(@sprite_save,150,200) button_zoom(@sprite_exit,160,250,0.8) @sprite_index.x = 150 @sprite_index.y = 200 when 2 button_zoom(@sprite_enter,140,140,0.8) button_zoom(@sprite_save,150,200,0.8) button_zoom(@sprite_exit,160,260) @sprite_index.x = 160 @sprite_index.y = 260 end end end
QQ截图20150819213943.jpg (27.67 KB, 下载次数: 21)
cinderelmini 发表于 2015-8-19 22:11
类似这种判定,脑内演算的时候似乎可行,实际上忽略了一点细节:
【sprite.zoom_x < k ? sprite.zoom_x += ...
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |