查看: 4049|回复: 6

[RMVA发布] 地图上显示地图名、坐标

[复制链接]

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2014-8-5 19:55:15 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 taroxd 于 2014-8-5 20:15 编辑

提问区回答问题写的。随手写的,所以写的结构很混乱。坐标什么的……懒得给你们设置了,自己调吧。反正都是变量= =

效果图: 搜狗截图_2014-08-05_19-48-07.png
@Cache

[pre lang="ruby" line="1"]
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 = 16
    @ellipse_sprite.x = 10
    @ellipse_sprite.y = 10
    @mapinfo_sprite.x = 10
    @mapinfo_sprite.y = 10
  end
  
  alias us_20140805 update_shadow
  def update_shadow
    us_20140805
    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[/pre]   
梦石
0
星屑
660
在线时间
1286 小时
注册时间
2011-6-14
回帖
3949
发表于 2014-8-5 20:13:09 | 显示全部楼层
卧槽为什么要画个椭圆直接画个渐变多好看啊……

点评

http://rm.66rpg.com/thread-369392-1-1.html 问此贴楼主  发表于 2014-8-5 20:14
回复

使用道具 举报

梦石
0
星屑
64
在线时间
31 小时
注册时间
2013-2-17
回帖
5
发表于 2015-10-20 20:44:21 | 显示全部楼层
{:2_275:}收下。看看
回复

使用道具 举报

梦石
0
星屑
50
在线时间
26 小时
注册时间
2015-10-13
回帖
16
发表于 2015-10-21 23:38:01 | 显示全部楼层
看看不说话{:2_274:}
回复

使用道具 举报

梦石
0
星屑
664
在线时间
101 小时
注册时间
2016-7-15
回帖
130
发表于 2016-7-16 13:41:39 | 显示全部楼层
看起来不错的样子
回复

使用道具 举报

梦石
0
星屑
1944
在线时间
404 小时
注册时间
2015-8-30
回帖
322
发表于 2016-7-16 18:25:46 | 显示全部楼层
椭圆……为何不用Window的windowskin?
小仙女一枚~
回复

使用道具 举报

梦石
0
星屑
50
在线时间
133 小时
注册时间
2016-4-28
回帖
137
发表于 2016-8-8 14:28:52 | 显示全部楼层
请问下大大 能不能用公共事件在物品中显示坐标  不在地图上显示 用物品才显示当前坐标
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部