Hi,
I am into making my first game, and I would like to show life in the form of hearts on the top left corner of the map screen. I just need to show life don;t want SP, exp etc. So changed some of the the line of a script already posted here. Thanks to him, the script is working and hhearts are showing up. All good till there.
The problem is once the life scipt is called. the game becomes super slow. The character takes years to move from one side to other side
I am not sure whether this is because I am calling this script as an event using page 3. option script.
then I gave it as Window_Hud.new. thats all....
Please find below the entire thing I used for this. I don't want to use any other conples scripts or SDK for this ... I just taking my first steps in understanding how it works,
class Window_Hud < Window_Base
def initialize
super(-16, -16, 672, 512)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Georgia"
self.contents.font.bold = true
self.contents.font.size = 14
self.opacity = 0
self.contents_opacity = $game_player.screen_y < 128 ? 90 : 255
@hp = 0
@maxhp = 0
update
end
def refresh
self.contents.clear
@hp = $game_party.actors[0].hp
@maxhp = $game_party.actors[0].maxhp
@x = 32
@y = 16
hearts = @maxhp / 250
for i in 1..hearts
x = ((i - 1) % 20) * 16 + @x
y = ((i - 1) / 20) * 16 + 4
if @hp >= i * 250
bitmap = RPG::Cache.icon('HeartF')
elsif (@hp < i * 250) && (@hp > (i - 1) * 250)
bitmap = RPG::Cache.icon('HeartH')
else
bitmap = RPG::Cache.icon('HeartE')
end
self.contents.blt(x, y + 8, bitmap, Rect.new(0, 0, 16, 16))
end
end
def update
refresh unless (@hp == $game_party.actors[0].hp and
@maxhp == $game_party.actors[0].maxhp)
end
Pease help !
I am into making my first game, and I would like to show life in the form of hearts on the top left corner of the map screen. I just need to show life don;t want SP, exp etc. So changed some of the the line of a script already posted here. Thanks to him, the script is working and hhearts are showing up. All good till there.
The problem is once the life scipt is called. the game becomes super slow. The character takes years to move from one side to other side
I am not sure whether this is because I am calling this script as an event using page 3. option script.
then I gave it as Window_Hud.new. thats all....
Please find below the entire thing I used for this. I don't want to use any other conples scripts or SDK for this ... I just taking my first steps in understanding how it works,
class Window_Hud < Window_Base
def initialize
super(-16, -16, 672, 512)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Georgia"
self.contents.font.bold = true
self.contents.font.size = 14
self.opacity = 0
self.contents_opacity = $game_player.screen_y < 128 ? 90 : 255
@hp = 0
@maxhp = 0
update
end
def refresh
self.contents.clear
@hp = $game_party.actors[0].hp
@maxhp = $game_party.actors[0].maxhp
@x = 32
@y = 16
hearts = @maxhp / 250
for i in 1..hearts
x = ((i - 1) % 20) * 16 + @x
y = ((i - 1) / 20) * 16 + 4
if @hp >= i * 250
bitmap = RPG::Cache.icon('HeartF')
elsif (@hp < i * 250) && (@hp > (i - 1) * 250)
bitmap = RPG::Cache.icon('HeartH')
else
bitmap = RPG::Cache.icon('HeartE')
end
self.contents.blt(x, y + 8, bitmap, Rect.new(0, 0, 16, 16))
end
end
def update
refresh unless (@hp == $game_party.actors[0].hp and
@maxhp == $game_party.actors[0].maxhp)
end
Pease help !