Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

naming each sprite in a list with a unique name

$
0
0

@diliupg wrote:

Is it possible to name each sprite in a list with a unique name so that I can identify each sprite to do various things?
`
public Energy(ContentManager contentManager, string spriteName, int x, int y, int i, string name)
{
this.sprite = contentManager.Load(spriteName);
this.energyPosX = x + (sprite.Width * i);
this.energyPosY = y;
this.typeName= name;

 drawRectangle = new Rectangle(energyPosX, energyPosY, sprite.Width / 2, sprite.Height / 2);

}`
I named each sprite with a string name + number ( this.typeName = name) but I cant access that name any where. Any suggestions?

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles