Jump to content


Member Since 15 May 2011
Offline Last Active May 22 2016 12:17 AM

Topics I've Started

Rpg Inventory gui

30 January 2016 - 11:25 PM

   I need a little idea about rpg inventory gui system. I have an inventory system in my game which works like most 2D browser based mmorpg. Single item occipies single slot. What I want to do is, make it more like diablo inventory system. Different items occupies different slot(s). I need some idea how to approach? I only need to know how do I detect the slot size of an item over inventory slots. My inventory right now is more like the left one, I want to convert it to right one (Diablo).



Thanks in advance

Return value

30 November 2014 - 10:33 AM


   I am trying to convert a function. Working with pointers, my function is looks like this -

The container-

std::vector<COne*> m_OneContainer;

When I have to find something, I do like this -

COne* CScene::getOneFromId(int id)
   for(auto &it: m_OneContainer)
      if((*it)->getID() == id)
         return *it;
   return 0;

But when I work with reference -

std::vector<COne> m_OneContainer;

Function -

COne& CScene::getOneFromId(int id)
   for(auto &it: m_OneContainer)
      if(it.getID() == id)
         return it;
   return 0; // What do I return here??

My question is what do I return as NULL?


Thank you

Layer and Frame?

15 June 2014 - 01:30 PM


   I am making a small game, where, now I want to implement layer and frame. Something like timeline. Each scene will consists of some layer and each layer will have some frames. Each frame will be used as a level and each layer will decide which entity will be visible. If a layer is invisible, all the entity belongs to that layer will be invisible.

   I just need some idea how do I implement them! As a class, struct or vectors etc. I only need idea, nothing else.


Thank you.

Calculating healthbar percentage

29 May 2014 - 12:30 PM


   I am trying to draw a health bar when player get hit by enemy. The healthbar is a rect, like -

rect( x, y, w, h)

The width is 177 and height is 12. The maximum health of the player may bigger then 100. So when player get hit the width of the rect should decrease according to the damage. Since the width of the rect is not 100, I am having a little difficulties to calculate the actual healthbar parcent.

What I am doing is -

unsigned int health = (currentHealth / maxHealth) * 100;

This only works if the width is 100. If I multiply with 177 (actual width of the rect), it always returns 0.
So how do I increase/decrease the percentage of the healthbar according to the width of the rect?


Thanks in advance.

Failed to start!

04 November 2013 - 01:07 PM


   I am using code::block and angelscript 2.27.1. Just now I tried to compile my app with the new release 2.28 and found the script is not creating the engine.

engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
if( engine == 0 )
    printf("Failed to create script engine.\n");
    return -1;

It is returning -1 here.


It is working fine with 2.27.