#how to customize sprite

21 messages · Page 1 of 1 (latest)

spare geyser
#

i tried this:

sprite = new Sprite(GFX.Game, "HeartWars/FireBall");
Add(sprite);

it crashed and said System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

but this works:

FireBallTexture = GFX.Game["HeartWars/FireBall"];
gentle copper
spare geyser
#

what should i do if i don't want animations

#

HeartWars/FireBall isn't a folder but a file

#

@gentle copper

spare geyser
#

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);

polar rampart
spare geyser
#

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>