Spam một thể đấy :D
Đùa chứ gà lắm đó mà , cái gì cũng ko biết, khổ lắm :DOne more question
Draw một cái thanh bar có hình bar_name trong thư mục Picture
như script sau của mình:
[php]class Window_Base < Window
def drawPic(x, y, bar_name)
bitmap = Cache.picture(bar_name)
self.contents.blt(x, y, bitmap, bitmap.rect)
end
end[/php]
Nhưng giờ muốn chiều dài của thanh bar này được tính theo variable[1] hoặc là theo lượng EXP của actor[1] thì làm sao nhỉ ?
Liệu có cần update kiểu gì ko nữa
Draw một cái thanh bar có hình bar_name trong thư mục Picture
như script sau của mình:
[php]class Window_Base < Window
def drawPic(x, y, bar_name)
bitmap = Cache.picture(bar_name)
self.contents.blt(x, y, bitmap, bitmap.rect)
end
end
[/php]
Nhưng giờ muốn chiều dài của thanh bar này được tính theo variable[1] hoặc là theo lượng EXP của actor[1] thì làm sao nhỉ ?
Liệu có cần update kiểu gì ko nữa
Nhưng giờ muốn chiều dài của thanh bar này được tính theo variable[1] hoặc là theo lượng EXP của actor[1] thì làm sao nhỉ ?
Liệu có cần update kiểu gì ko nữa
[/quote] Phải update nếu muốn vẽ hud, btw mình không biết làm. :huhu:
Cho mình hỏi mấy cái alias ở đây có ý nghĩa gì?
[php]
class Scene_Map < Scene_Base
alias start_window start
alias term_window terminate
alias update_window update
def start
start_window @winhud = Window_Hud.new
update
end
def terminate @winhud.dispose
term_window
end
def update
update_window @winhud.update
end
end
[/php]
^Mình nhớ giải đáp cái Alias cho bạn rồi mà nhỉ?
Đại khái là thêm code vào cái def đó mà không làm thay đổi cái gốc.
What is an alias? Alias simply means a new name for our method. We need to call the alias on that method as well, it is called Calling the Original Method. If you are wondering why there is a : sign on the alias, that is because : signed things are considered methods.
Comments
vậy thôi mà cũng phải hỏi tiếp sao
Đùa chứ gà lắm đó mà
Draw một cái thanh bar có hình bar_name trong thư mục Picture
như script sau của mình:
[php]class Window_Base < Window
def drawPic(x, y, bar_name)
bitmap = Cache.picture(bar_name)
self.contents.blt(x, y, bitmap, bitmap.rect)
end
end[/php]
Nhưng giờ muốn chiều dài của thanh bar này được tính theo variable[1] hoặc là theo lượng EXP của actor[1] thì làm sao nhỉ ?
Liệu có cần update kiểu gì ko nữa
Phải update nếu muốn vẽ hud, btw mình không biết làm. :huhu:
rw = $chiều_dài_ảnh
src_rect = Rect.new(0, 0, rw, chiều_cao_ảnh)
contents.blt(0,0, bitmap, src_rect)
Nếu có thì update cơ bản như nào nhỉ ? :D
[php]
class Scene_Map < Scene_Base
alias start_window start
alias term_window terminate
alias update_window update
def start
start_window
@winhud = Window_Hud.new
update
end
def terminate
@winhud.dispose
term_window
end
def update
update_window
@winhud.update
end
end
[/php]
Đại khái là thêm code vào cái def đó mà không làm thay đổi cái gốc.
[php]draw_text(toado_x, toado_y, 160, 32 , "Kinh nghiiệm của bạn là "+$game_actors[1].exp)[/php]
__
Và mình truy vấn exp của nhân vật để làm thông số tính toán mà ko có đc , như này
@So_kinh_nghiem_can = $game_actors[1].next_level_exp - $game_actors[1].exp
Mà nó vẫn trả về kết quả là 0 .
:P uh nhỉ, mình đầu óc hay quên lắm, thanks bạn lần 2. :D
$game_variables[1] = ($game_actors[1].next_level_exp - $game_actors[1].exp)
Thử thay bằng kiểu này coi sao, rồi lấy nó ra từ variable 1. :huhu: :huhu: