Game Development Community

Inventory levels.

by Tyler Slabinski · in Technical Issues · 09/25/2007 (6:00 pm) · 5 replies

In my game I would like the players to be able to hold unlimited items until it's weight is too high. Would I be able to do this by just saying the following in the "onPickup" function:

If (weightLevel = maxWeight);
{
   echo ("Max weight exceeded");
}
else
{
   addObject();
}


And in the addObject(); I put in the following:

currentWeight + weightLevel = currentWeight;

I have been learning out of the GPGT book and I am hoping to be able to get some experience.

#1
09/25/2007 (10:20 pm)
It should be greater than or equal tyler
If (weightLevel >= maxWeight);

& yes u r on the right track
#2
09/26/2007 (1:04 pm)
Ok. So other then that it's ok?
#3
09/26/2007 (1:22 pm)
Yeap, that idea is the right one, just make sure that u script it right thats it :)
#4
09/26/2007 (1:25 pm)
What if I want it to be able to equal it? Should I have this instead?:

if (weightLevel > maxWeight);
#5
09/26/2007 (2:08 pm)
Yeap, that should be it