battle sprites resize

This commit is contained in:
infinitefusion
2021-07-15 10:46:13 -04:00
parent abfad12b0a
commit 17c136e050
4 changed files with 30 additions and 12 deletions

View File

@@ -16,8 +16,13 @@ module Settings
NB_POKEMON = 420
CUSTOM_BATTLERS_FOLDER="Graphics/CustomBattlers/"
BATTLERS_FOLDER="Graphics/Battlers/"
FRONTSPRITE_POSITION_OFFSET = 75
BACKSPRITE_POSITION_OFFSET = 60
FRONTSPRITE_POSITION_OFFSET = 15
FRONTSPRITE_SCALE = 0.6666666
BACKRPSPRITE_SCALE = 1
BACKSPRITE_POSITION_OFFSET = 20
# The generation that the battle system follows. Used throughout the battle
# scripts, and also by some other settings which are used in and out of battle
# (you can of course change those settings to suit your game).

View File

@@ -18,15 +18,6 @@ class AnimatedBitmap
end
end
# def initialize(file,hue=0)
# raise "filename is nil" if file==nil
# if file[/^\[(\d+)\]/]
# @bitmap=PngAnimatedBitmap.new(file,hue)
# else
# @bitmap=GifBitmap.new(file,hue)
# end
# end
def pbSetColor(r = 0, g = 0, b = 0, a = 255)
for i in 0..@bitmap.bitmap.width
for j in 0..@bitmap.bitmap.height
@@ -90,6 +81,22 @@ class AnimatedBitmap
@bitmap.copy;
end
def scale_bitmap(scale)
return if scale == 1
new_width = @bitmap.bitmap.width * scale
new_height = @bitmap.bitmap.height * scale
destination_rect = Rect.new(0, 0, new_width, new_height)
source_rect = Rect.new(0, 0, @bitmap.bitmap.width, @bitmap.bitmap.height)
new_bitmap = Bitmap.new(new_width,new_height)
new_bitmap.stretch_blt(
destination_rect,
@bitmap.bitmap,
source_rect
)
@bitmap.bitmap = new_bitmap
end
def mirror
for x in 0..@bitmap.bitmap.width / 2
for y in 0..@bitmap.bitmap.height - 2

View File

@@ -551,6 +551,12 @@ class PokemonBattlerSprite < RPG::Sprite
@_iconBitmap.dispose if @_iconBitmap
@_iconBitmap = GameData::Species.sprite_bitmap_from_pokemon(@pkmn, back)
@_iconBitmap.mirror if back
if back
@_iconBitmap.scale_bitmap(Settings::BACKRPSPRITE_SCALE)
else
@_iconBitmap.scale_bitmap(Settings::FRONTSPRITE_SCALE)
end
self.bitmap = (@_iconBitmap) ? @_iconBitmap.bitmap : nil
pbSetPosition
end

View File

@@ -320,8 +320,8 @@ class PokeBattle_Scene
pkmnSprite = @sprites["pokemon_#{idxBattler}"]
shadowSprite = @sprites["shadow_#{idxBattler}"]
back = !@battle.opposes?(idxBattler)
pkmnSprite.setPokemonBitmap(pkmn,back)
shadowSprite.setPokemonBitmap(pkmn)
pkmnSprite.setPokemonBitmap(pkmn,back)
# Set visibility of battler's shadow
shadowSprite.visible = pkmn.species_data.shows_shadow? if shadowSprite && !back
end