幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 891|回复: 4

[求助]关于66桑的“战斗中显示敌人HP、SP”的脚本改造和简

[复制链接]

20

主题

357

帖子

4300

积分

⑥精研

真·RMXP废柴

积分
4300
发表于 2005-6-22 16:39:23 | 显示全部楼层 |阅读模式
由于不懂RGSS,所以,改造脚本对俺来说真成了一项比画地图写剧本还要艰难的事(仅比找美工简单一点)...

首先先感谢66桑制作了“战斗中显示敌人HP、SP”的脚本并无偿提供给了我们这些新人使用。使用之余,突然想改造一下这个脚本...于是就得到了这样的一段代码:

def carol3_draw_hp_bar(actor, x, y, width = 280) #宽度可调
self.contents.font.color = text_color(8)
self.contents.fill_rect(x-1, y+12, width+2,10, Color.new(225, 0, 0, 185))
w = width * actor.hp / actor.maxhp
self.contents.fill_rect(x, y+13, w,1, Color.new(255, 68, 0, 255))
self.contents.fill_rect(x, y+14, w,2, Color.new(255, 204, 119, 255))
self.contents.fill_rect(x, y+16, w,3, Color.new(255, 238, 0, 255))
self.contents.fill_rect(x, y+19, w,2, Color.new(255, 204, 119, 255))
self.contents.fill_rect(x, y+21, w,1, Color.new(255, 153, 119, 255))
self.contents.fill_rect(x, y+22, w,1, Color.new(0, 0, 0, 255))
# 描绘HP槽的左边框
self.contents.fill_rect(x-2, y+12, 2,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-3, y+13, 3,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-4, y+14, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-4, y+15, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-4, y+16, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-4, y+17, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-4, y+18, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-4, y+19, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-4, y+20, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-3, y+21, 3,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-2, y+22, 2,1, Color.new(255, 255, 255, 255))
# 描绘HP槽的底/顶边框
self.contents.fill_rect(x-2, y+22, 284,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-2, y+12, 284,1, Color.new(255, 255, 255, 255))
# 描绘HP槽的右边框
self.contents.fill_rect(x+280, y+12, 2,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+280, y+13, 3,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+280, y+14, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+280, y+15, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+280, y+16, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+280, y+17, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+280, y+18, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+280, y+19, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+280, y+20, 4,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+280, y+21, 3,1, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+280, y+22, 2,1, Color.new(255, 255, 255, 255))
self.contents.draw_text(x-78,y,128,32,"HP:",1)
self.contents.font.color = normal_color
end

于是,便得到了这样的效果:




但是...这样一来脚本就变得十分的冗长,FC新人在此求高人帮忙,有何办法能把上述代码优化一下呢...先性谢过了~

[此贴子已经被作者于2005-6-22 23:58:28编辑过]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
《非·英雄传说Episode 1.5  —传说的后来—》 ↑ 制作中。别点,不是链接...
回复

使用道具 举报

13

主题

113

帖子

1672

积分

⑥精研

永远的不死鸟

积分
1672
发表于 2005-6-22 21:27:37 | 显示全部楼层
[em04]我不会改的说,您好厉害啊!
回复 支持 反对

使用道具 举报

17

主题

294

帖子

3097

积分

⑥精研

积分
3097
发表于 2005-6-25 14:28:28 | 显示全部楼层
[em04][em04]

这个应该。。

[em04][em04]

大部分人都会改吧。。

[此贴子已经被作者于2005-6-25 14:29:15编辑过]
加油灌水~!
回复 支持 反对

使用道具 举报

carol3 该用户已被删除
发表于 2005-6-27 00:02:16 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

13

主题

113

帖子

1672

积分

⑥精研

永远的不死鸟

积分
1672
发表于 2005-6-27 11:27:05 | 显示全部楼层
晕死,怎么用了超级纵版,敌人显血没有啦?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2025-6-21 15:17 , Processed in 0.011819 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表