Page 1 of 1

Equipment Slots

Posted: 29 May 2008, 18:45
by allenmoatallen
Hey guys! I have a question, if I want to determine which equip slot an item should be put into, how would I go about that? I am attempting to get equipment to show on the character screen, but have no way of figuring out which slot to set the sprite to. My code so far looks like this:

Code: Select all

void
PlayerBox::draw(gcn::Graphics *graphics)
{
    if (mPlayer)
    {
        // Draw character
        int x, y, bs;
        bs = getFrameSize();
        x = getWidth() / 2 - 16 + bs;
        y = getHeight() / 2 + bs;
        mPlayer->draw(static_cast<Graphics*>(graphics), x, y);
		
		for (int i = 0; i < EQUIPMENT_SIZE; i++)
		{
			Item *item = mEquipment->getEquipment(i);
			ItemInfo const *info = &item->getInfo();
			
			if (item->getId() > 2)
			{
				mPlayer->setSprite(6, item->getId());
			}
		}
    }
}