rigbycwts
Hmm, hmm.
- 98
- Posts
- 11
- Years
- Seen Feb 22, 2019
I was working on improving this tutorial to incorporate an image of a Gym Leader's badge at the start of a battle, similar to the Gen 6 games. At first it worked, like this:
However, when the Pokemon are sent out, the badge image is still left on the screen instead of moving out with the sprite, like this:
What I did is:
First, I added a new function to PSystem_Utilities:
Then I modified setTrainerBitmap to utilise the badge image:
In the initialize function under the class DynamicTrainerSprite, I added the following line:
Inside EliteBattle_Scene, I replaced:
with this:
And that's it. So, how do I "dispose" of the badge image when the Pokemon are sent out?
Spoiler:
![[PokeCommunity.com] How to "dispose" a sprite? [PokeCommunity.com] How to "dispose" a sprite?](https://i.imgur.com/AQuTfGQ.png)
However, when the Pokemon are sent out, the badge image is still left on the screen instead of moving out with the sprite, like this:
Spoiler:
![[PokeCommunity.com] How to "dispose" a sprite? [PokeCommunity.com] How to "dispose" a sprite?](https://i.imgur.com/oYXu41L.png)
What I did is:
First, I added a new function to PSystem_Utilities:
Code:
def pbTrainerBadgeFile(type)
return nil if !type
bitmapFileName=sprintf("Graphics/Characters/badge%s",getConstantName(PBTrainers,type)) rescue nil
if !pbResolveBitmap(bitmapFileName)
bitmapFileName=sprintf("Graphics/Characters/badge%03d",type)
end
return bitmapFileName
end
Code:
def setTrainerBitmap(file,hasbadge=false,badgefile=nil)
unless badgefile.nil?
@bitmap=AnimatedBitmapWrapper.new(badgefile,TRAINERSPRITESCALE)
@[email protected]
@badge.ox=(@bitmap.width/2) - 100
end
@bitmap=AnimatedBitmapWrapper.new(file,TRAINERSPRITESCALE)
@[email protected]
@[email protected]
#@sprite.ox=(@bitmap.width/2) + 150
if hasbadge
@sprite.ox=(@bitmap.width/2) + 60
else
@sprite.ox=(@bitmap.width/2) + 150
end
if @doublebattle
if @index==-2
@sprite.ox-=150
elsif @index==-1
@sprite.ox+=150
end
end
@[email protected]/4
self.formatShadow
@shadow.skew(74)
end
Code:
@badge=Sprite.new(@viewport)
Code:
@sprites["trainer"].setTrainerBitmap(trainerfile)
Code:
if @battle.opponent.trainertype > 58 && @battle.opponent.trainertype < 67
@sprites["trainer"].setTrainerBitmap(trainerfile,true,pbTrainerBadgeFile(@battle.opponent.trainertype))
else
@sprites["trainer"].setTrainerBitmap(trainerfile)
end