#how to customize sprite
21 messages · Page 1 of 1 (latest)
if you actually want a custom sprite with animations etc., you need a custom sprites xml. see for example Flag Pickups in max' helping hand:
https://github.com/max4805/MaxHelpingHand/blob/master/Entities/FlagPickup.cs#L89
https://github.com/max4805/MaxHelpingHand/blob/master/Graphics/Sprites.xml#L20
what should i do if i don't want animations
HeartWars/FireBall isn't a folder but a file
@gentle copper
now it's at Graphics\Atlases\Gameplay\HeartWars\HeartWarsFireBall\idle00.png
and here is my Sprites.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Sprites>
<HeartWarsFireBall path="HeartWars/HeartWarsFireBall">
<Justify x="0.5" y="0.5" />
<Anim id="idle" path="idle" delay="0.1" frames="0" />
</HeartWarsFireBall>
</Sprites>
it doesn't work
game crashes when i execute this.sprite.Play("idle", true, false);
what happens if you make it a 2-frame animation, with the same frame twice? i.e. copy the image, rename it so there's an 00 and an 01, and make it animate between them?
i'll try
<?xml version="1.0" encoding="utf-8" ?>
<Sprites>
<HeartWarsFireBall path="HeartWars/HeartWarsFireBall">
<Justify x="0.5" y="0.5" />
<Anim id="idle" path="idle" delay="0.1" frames="0-1" />
</HeartWarsFireBall>
</Sprites>
this.sprite.Play("idle", true, false);
still crashing
there is Graphics\Atlases\Gameplay\HeartWars\HeartWarsFireBall\idle0.png and Graphics\Atlases\Gameplay\HeartWars\HeartWarsFireBall\idle1.png
i tried GFX.SpriteBank.Create("HeartWars/HeartWarsFireBall")
and got this
System.Exception: Missing animation name in SpriteData: 'HeartWars/HeartWarsFireBall'!
at DMD<Monocle.SpriteBank::Create>(SpriteBank this, String id)
Sprites.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Sprites>
<HeartWarsFireBall path="HeartWars/HeartWarsFireBall">
<Center/>
<Anim id="idle" path="idle" frames="0"/>
</HeartWarsFireBall>
</Sprites>