Project1
标题:
如何实现类似这样的变量值显示?(有图有真相)
[打印本页]
作者:
bloodyliao
时间:
2015-2-13 21:51
标题:
如何实现类似这样的变量值显示?(有图有真相)
本帖最后由 bloodyliao 于 2015-2-13 22:57 编辑
如图,类似这样的变量值显示是怎么做到的呢?
作者:
taroxd
时间:
2015-2-14 07:43
参考
https://rpg.blue/thread-369305-1-1.html
平行四边形同理但是更简单
作者:
bloodyliao
时间:
2015-2-14 10:12
这个是vx的,希望能改成ace语句……
#==============================================================================
# ** Window_Lunar
#------------------------------------------------------------------------------
# This window displays the amount of gold.
#==============================================================================
class Window_Lunar < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 544, 128)
self.opacity = 0
@lunar_sprites = [Sprite.new, Sprite.new, Sprite.new, Sprite.new]
bmp = Bitmap.new(320, 100)
bmp.skew_blt_r(0, 0, Cache.system("Eclipse_1"), Cache.system("Eclipse_1").rect, 45)
@lunar_sprites[0].bitmap = bmp
bmp = Bitmap.new(320, 100)
bmp.skew_blt_r(0, 0, Cache.system("Eclipse_2"), Cache.system("Eclipse_2").rect, 45)
@lunar_sprites[1].bitmap = bmp
bmp = Bitmap.new(320, 100)
bmp.skew_blt_r(0, 0, Cache.system("Eclipse_3"), Cache.system("Eclipse_3").rect, 45)
@lunar_sprites[2].bitmap = bmp
@lunar_sprites[3].bitmap = Cache.system("Lunar_Warn")
for sprite in @lunar_sprites
sprite.opacity = 0
sprite.blend_type = 2
sprite.x = 43
sprite.y = 16
sprite.z = 30000
sprite.visible = true
sprite.zoom_x = sprite.zoom_y = 0.5
end
@lunar_sprites[3].blend_type = 1
@lunar_sprites[3].x = 36
@lunar_sprites[3].y = 10
@lunar_sprites[3].z = 30001
@lunar_sprites[3].zoom_x = @lunar_sprites[3].zoom_y = 1
@ecl_count = 3
@lunar = $game_variables[3]
@warn_glow = false
refresh
end
def dispose
for sprite in @lunar_sprites
sprite.bitmap.dispose
sprite.dispose
end
super
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @lunar != $game_variables[3]
@lunar = $game_variables[3]
end
bmp = Bitmap.new(self.contents.rect.width, self.contents.rect.height)
bmp.blt(0, 0, Cache.system("Lunar_Back"), Cache.system("Lunar_Back").rect)
lunar_w = ($game_variables[3] * 256) / 1000
lunar_rect = Rect.new(0, 0, lunar_w, 40)
bmp.blt(0, 0, Cache.system("Lunar_Fill"), lunar_rect)
solar_rect = Rect.new(lunar_w + 2, 0, 254 - lunar_w, 40)
bmp.blt(lunar_w + 2, 0, Cache.system("Solar_Fill"), solar_rect)
ebmp = Bitmap.new(self.contents.rect.width, self.contents.rect.height)
ebmp.skew_blt_r(16, 16, bmp, bmp.rect, 45)
e_rect = ebmp.rect
e_rect.width /= 2
e_rect.height /= 2
self.contents.stretch_blt_r(e_rect, ebmp, ebmp.rect)
fs = self.contents.font.size
self.contents.font.size = 24
lunar_percent = ($game_variables[3] * 0.1).to_s
self.contents.font.italic = true
self.contents.draw_text(12, 18, 160, 32, lunar_percent + "%", 2)
self.contents.font.italic = false
end
def update
super
if @lunar != $game_variables[3]
refresh
@lunar = $game_variables[3]
end
if @lunar < 250
if @warn_glow
@lunar_sprites[3].opacity += 16
if @lunar_sprites[3].opacity >= 255
@warn_glow = false
end
else
@lunar_sprites[3].opacity -= 16
if @lunar_sprites[3].opacity <= 0
@warn_glow = true
end
end
else
@warn_glow = false
@lunar_sprites[3].opacity -= 16
end
if $game_switches[3]
if @ecl_count == 0
@lunar_sprites[0].opacity = [@lunar_sprites[0].opacity + 4, 255].min
@lunar_sprites[1].opacity = [@lunar_sprites[1].opacity - 4, 1].max
@lunar_sprites[2].opacity = [@lunar_sprites[2].opacity - 4, 1].max
if @lunar_sprites[0].opacity == 255
@ecl_count = 1
end
elsif @ecl_count == 1
@lunar_sprites[1].opacity = [@lunar_sprites[1].opacity + 4, 255].min
@lunar_sprites[0].opacity = [@lunar_sprites[0].opacity - 4, 1].max
@lunar_sprites[2].opacity = [@lunar_sprites[2].opacity - 4, 1].max
if @lunar_sprites[1].opacity == 255
@ecl_count = 2
end
elsif @ecl_count == 2
@lunar_sprites[2].opacity = [@lunar_sprites[2].opacity + 4, 255].min
@lunar_sprites[0].opacity = [@lunar_sprites[0].opacity - 4, 1].max
@lunar_sprites[1].opacity = [@lunar_sprites[1].opacity - 4, 1].max
if @lunar_sprites[2].opacity == 255
@ecl_count = 0
end
else
@lunar_sprites[0].opacity = [@lunar_sprites[0].opacity + 16, 255].min
@lunar_sprites[1].opacity = [@lunar_sprites[1].opacity - 16, 1].max
@lunar_sprites[2].opacity = [@lunar_sprites[2].opacity - 16, 1].max
if @lunar_sprites[0].opacity == 255
@ecl_count = 1
end
end
else
for sprite in @lunar_sprites
sprite.opacity -= 16 if @lunar_sprites.index(sprite) < 3
@ecl_count = 3
end
end
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1