赞 | 0 |
VIP | 31 |
好人卡 | 3 |
积分 | 5 |
经验 | 31161 |
最后登录 | 2024-12-10 |
在线时间 | 340 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 510
- 在线时间
- 340 小时
- 注册时间
- 2008-8-13
- 帖子
- 526
|
2楼
楼主 |
发表于 2009-7-3 15:00:05
|
只看该作者
夜想曲怪物问题[简单]
# ■ ARPG_Enemy
#------------------------------------------------------------------------------
# 在地图上处理敌人HP以及状态的类。
#==============================================================================
class ARPG_Enemy
# @bitmap1 = Bitmap.new("Graphics/Pictures/领主-光之城主赛格哈特,8")
# @src_rect1 = Rect.new(5,5,@bitmap1.width, @bitmap1.height)
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
@sprite = Sprite.new
@sprite.bitmap = Bitmap.new(602,200)
@sprite.z += 20
# @name = []
@oldx = 0
@oldy = 0
@oldhp = 0
@oldsp = 0
@parameter = []
# @event.name =
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
@sprite.dispose
@parameter.each{|pict|pict.visible = val}
end
#--------------------------------------------------------------------------
# ● 刷新一下数值
#--------------------------------------------------------------------------
def refresh(event)
$game_variables[18] = event.sp
k = event.hp * 100 / event.maxhp
$game_variables[59] = k
unless $game_variables[18] == 1299 or $game_variables[18] == 51 or $game_variables[18] == 61
@sprite.bitmap.clear
@sprite.x = 34#event.screen_x-16
@sprite.y = 8#event.screen_y
# $game_screen.pictures[36].show("HPE", 0,41,21,100,100,255,0)
# $game_screen.pictures[35].show("HPE-", 0,41,21,100,100,255,0)
#$game_screen.pictures[34].show("HPE", 0,41,21,100,100,155,0)
@sprite.bitmap.fill_rect(0,0,603,30,Color.new(0,0,0,255))
if $game_variables[59] >= 0 and $game_variables[59] <= 9
@sprite.bitmap.fill_rect(1,1,600,27,Color.new(0,0,0,255))
p = event.hp * 600 / event.maxhp
$game_variables[60] = p
@sprite.bitmap.fill_rect(1,2,p,27,Color.new(222,0,0,255))#(1,1,w,12,Color.new(222,0,0,255))
end
if $game_variables[59] >= 10 and $game_variables[59] <= 19
@sprite.bitmap.fill_rect(1,1,600,27,Color.new(222,0,0,255))
p = event.hp * 600 / event.maxhp
$game_variables[60] = p
@sprite.bitmap.fill_rect(1,2,p,27,Color.new(255,132,0,255))#(1,1,w,12,Color.new(222,0,0,255))
end
if $game_variables[59] >= 20 and $game_variables[59] <= 29
@sprite.bitmap.fill_rect(1,1,600,27,Color.new(255,132,0,255))
p = event.hp * 600 / event.maxhp
$game_variables[60] = p
@sprite.bitmap.fill_rect(1,2,p,27,Color.new(148,206,0,255))#(1,1,w,12,Color.new(222,0,0,255))
end
if $game_variables[59] >= 30 and $game_variables[59] <= 39
@sprite.bitmap.fill_rect(1,1,600,27,Color.new(148,206,0,255))
p = event.hp * 600 / event.maxhp
$game_variables[60] = p
@sprite.bitmap.fill_rect(1,2,p,27,Color.new(0,123,206,255))#(1,1,w,12,Color.new(222,0,0,255))
end
if $game_variables[59] >= 40 and $game_variables[59] <= 49
@sprite.bitmap.fill_rect(1,1,600,27,Color.new(0,123,206,255))
p = event.hp * 600 / event.maxhp
$game_variables[60] = p
@sprite.bitmap.fill_rect(1,2,p,27,Color.new(140,132,255,255))#(1,1,w,12,Color.new(222,0,0,255))
end
if $game_variables[59] >= 50 and $game_variables[59] <= 59
@sprite.bitmap.fill_rect(1,1,600,27,Color.new(140,132,255,255))
p = event.hp * 600 / event.maxhp
@sprite.bitmap.fill_rect(1,2,p,27,Color.new(222,0,0,255))#(1,1,w,12,Color.new(222,0,0,255))
end
if $game_variables[59] >= 60 and $game_variables[59] <= 69
@sprite.bitmap.fill_rect(1,1,600,27,Color.new(222,0,0,255))
p = event.hp * 600 / event.maxhp
$game_variables[60] = p
@sprite.bitmap.fill_rect(1,2,p,27,Color.new(255,132,0,255))#(1,1,w,12,Color.new(222,0,0,255))
end
if $game_variables[59] >= 70 and $game_variables[59] <= 79
@sprite.bitmap.fill_rect(1,1,600,27,Color.new(255,132,0,255))
p = event.hp * 600 / event.maxhp
$game_variables[60] = p
@sprite.bitmap.fill_rect(1,2,p,27,Color.new(148,206,0,255))#(1,1,w,12,Color.new(222,0,0,255))
end
if $game_variables[59] >= 80 and $game_variables[59] <= 89
@sprite.bitmap.fill_rect(1,1,600,27,Color.new(148,206,0,255))
p = event.hp * 600 / event.maxhp
$game_variables[60] = p
@sprite.bitmap.fill_rect(1,2,p,27,Color.new(0,123,206,255))#(1,1,w,12,Color.new(222,0,0,255))
end
if $game_variables[59] >= 90 and $game_variables[59] <= 99
@sprite.bitmap.fill_rect(1,1,600,27,Color.new(0,123,206,255))
p = event.hp * 600 / event.maxhp
$game_variables[60] = p
@sprite.bitmap.fill_rect(1,2,p,27,Color.new(140,132,255,255))#(1,1,w,12,Color.new(222,0,0,255))
end
if $game_variables[59] == 100
@sprite.bitmap.fill_rect(1,1,600,27,Color.new(0,123,206,255))
@sprite.bitmap.fill_rect(1,2,600,27,Color.new(140,132,255,255))#(1,1,w,12,Color.new(222,0,0,255))
end
@sprite.bitmap.fill_rect(0,0,0,0,Color.new(255,255,255,255))
@sprite.bitmap.fill_rect(0,0,0,0,Color.new(20,20,20,255))
w = event.sp * 103 / event.maxsp
@sprite.bitmap.fill_rect(0,0,0,0,Color.new(20,20,255,255))
else
@sprite.bitmap.clear
@sprite.x = 40#event.screen_x-16
@sprite.y = 22#event.screen_y
# $game_screen.pictures[36].show("HPE", 0,41,21,100,100,255,0)
# $game_screen.pictures[35].show("HPE-", 0,41,21,100,100,255,0)
#$game_screen.pictures[34].show("HPE", 0,41,21,100,100,155,0)
@sprite.bitmap.fill_rect(0,0,584,14,Color.new(231,206,156,255))
@sprite.bitmap.fill_rect(1,1,582,12,Color.new(0,0,0,255))
w = event.hp * 580 / event.maxhp
k = event.hp * 100 / event.maxhp
$game_variables[19] = k
@sprite.bitmap.fill_rect(2,2,w,10,Color.new(222,0,0,255))#(1,1,w,12,Color.new(222,0,0,255))
@sprite.bitmap.fill_rect(0,0,0,0,Color.new(255,255,255,255))
@sprite.bitmap.fill_rect(0,0,0,0,Color.new(20,20,20,255))
w = event.sp * 103 / event.maxsp
@sprite.bitmap.fill_rect(0,0,0,0,Color.new(20,20,255,255))
# $game_screen.pictures[34].move(100, 0,41,21,k,100,255,0)
#$game_screen.pictures[35].move(10, 0,41,21,k,100,255,0)
#$game_screen.pictures[36].move(1, 0,41,21,k,100,255,0)
# $game_screen.pictures[37].show($game_variables[18], 0,15,11,100,100,255,0)
# @parameter[7] = Sprite.new
# @parameter[7].bitmap = Bitmap.new(100,100)
# @parameter[7].bitmap.blt(0,0,RPG::Cache.picture(event.sp),Rect.new(0,0,150,120))
# @parameter[7].x = -100;@parameter[0].y = 100
# @sprite.bitmap.fill_text(1,1,580,14,Color.new(0,0,0,255))
# w = event.hp * 580 / event.maxhp
#@sprite.bitmap.fill_rect(1,1,w,14,Color.new(225,0,0,255))
# src_rect = Rect.new(5, 5, bitmap.width, bitmap.height)
# 这里本来是渐变血条的说``-_____-为了照顾速度````废掉了
=begin
cw = event.hp*33/event.maxhp
@sprite.bitmap.fill_rect(0,0,35,6,Color.new(255,255,255))
for i in 0..3
@sprite.bitmap.fill_rect(1,1+i,33,1,Color.new(163-(i*16),128-(i*16),128-(i*16)))
end
for i in 0..3
@sprite.bitmap.fill_rect(1,1+i,cw,1,Color.new(255-(i*16),128-(i*16),128-(i*16)))
end
cw = event.sp*33/event.maxsp
@sprite.bitmap.fill_rect(0,8,35,6,Color.new(255,255,255))
for i in 0..3
@sprite.bitmap.fill_rect(1,9+i,33,1,Color.new(128-(i*16),128-(i*16),163-(i*16)))
end
for i in 0..3
@sprite.bitmap.fill_rect(1,9+i,cw,1,Color.new(128-(i*16),128-(i*16),255-(i*16)))
end
=end
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def update(event)
# 避免一些不必要的刷新
if $refresh["enemy_states"]
for e in $game_map.events.values
next if !e.is_enemy?
if e.states.size > 0
for i in e.states
e.states_time[i] -= 1
if e.states_time[i] <= 0
e.states.delete(i)
e.states_time.delete(i)
end
end
if e.slip_damage? and Graphics.frame_count%10 == 0
e.hp -= [e.maxhp / 100, 1].max
end
end
end
end
if event.nil? or (!event.nil? and event.maxhp <= 0)
@sprite.bitmap.clear
$game_screen.pictures[37].show("", 0,15,11,100,100,255,0)
$game_screen.pictures[36].show("", 0,15,11,100,100,255,0)
$game_screen.pictures[35].show("", 0,15,11,100,100,255,0)
# $game_screen.pictures[34].show("", 0,15,11,100,100,255,0)
return
end
refresh(event) if @oldx != event.x or @oldy != event.y or @oldhp != event.hp or @oldsp != event.sp
end
end
↑这是脚本,放进夜想曲,帮我把它改成多层血条,谢谢!!! |
|