| 赞 | 4 |
| VIP | |
| 好人卡 | |
| 积分 | 16 |
| 经验 | |
| 最后登录 | 2026-9-24 |
| 在线时间 | 523 小时 |
- 梦石
- 0
- 星屑
- 1554
- 在线时间
- 523 小时
- 注册时间
- 2015-8-23
- 回帖
- 83
|
发表于 2026-7-14 13:09:39
|
显示全部楼层
你想做什么效果呢?时在地图显示xy轴数值吗?做挖宝的机制?
[fold=坐标脚本(直接插入就能在游戏显示了)]module Cache
@Cache ||= {}
def self.ellipse(a, b, color)
key = [:ellipse, a, b, color]
unless include?(key)
@cache[key] = bitmap = Bitmap.new(2 * a, 2 * b)
0.step(2*Math::PI, 0.01) do |theta|
bitmap.set_pixel((a+a*Math.cos(theta)).to_i,
(b+b*Math.sin(theta)).to_i, color)
end
end
@cache[key]
end
end
class Spriteset_Map
alias cs_20140805 create_shadow
def create_shadow
cs_20140805
@ellipse_sprite = Sprite.new
a, b, c = 50, 40, Color.new(255,0,0)
#@ellipse_sprite.bitmap = Cache.ellipse(a,b,c).clone
#@ellipse_sprite.bitmap.fill_rect(0, b, 2*a, 1, c)
@mapinfo_sprite = Sprite.new
@mapinfo_sprite.bitmap = Bitmap.new(2*a, 2*b)
@mapinfo_sprite.bitmap.font.size = 20
#@ellipse_sprite.x = 10
#@ellipse_sprite.y = 10
@mapinfo_sprite.x = 430
@mapinfo_sprite.y = 350
end
alias us_20140805 update_shadow
def update_shadow
us_20140805
@mapinfo_sprite.visible = @ellipse_sprite.visible = $game_switches[13]
if @mapinfo_to_draw != mapinfo_to_draw
n, x, y = @mapinfo_to_draw = mapinfo_to_draw
text = "X:#{x} Y:#{y}"
b = @mapinfo_sprite.bitmap
b.clear
b.draw_text(0,20,b.width,20,n,1)
b.draw_text(0,40,b.width,20,text,1)
end
end
alias ds_20140805 dispose_shadow
def dispose_shadow
ds_20140805
# @ellipse_sprite.bitmap.dispose
@ellipse_sprite.dispose
@mapinfo_sprite.bitmap.dispose
@mapinfo_sprite.dispose
end
def mapinfo_to_draw
[$game_map.display_name, $game_player.x, $game_player.y]
end
end
[/fold] |
|