I hope I’m putting this into the right place, but I was wondering if
someone could help me out with a game I’m making.
I am using Visual Studio C# to make an RPG, right now so far i have the
program give you items when you “open a treasure chest” and these items
are put into an array. After these items are put into an array and you
open your inventory form the items stored in the array are put into
labels (Short sword = array and that is in slot 1; so on and so
forth). I now want to know how to, when slot1 is clicked on (it is a
label with “Short Sword” written in it due to an array loading it) i
want it to be equiped to a certain place, like to the left hand for
If this isn’t too confusing and someone could give me some guidance on a
way to do this that would be great.
Please log in or register to post a reply.
When doing weapons classes you want them to typically be that: classes.
You want a weapon class that is abstract that describes what types of
information about the weapon are known. Then you can make more specific
classifications such as a one-handed weapon. If it is a one-handed
weapon you can have an “equip” method that will check if it is being
equipped in the proper location on the character.
I hope this helps,
What i thought of after i made this post and was wondering if it would
work was using databases (through microsoft office access) that had all
the information like that, or would classes still be better than using
databases. I would love to EVENTUALLY have maaaany items (weapons,
armors, potions, etc.) that could be used but i will still look into
Many items after i have the base game coded.. just keep expanding.
Databases are huge overkill for a game that’s not an MMO.
You should probably have a class hierarchy for items, like maybe a CItem
class and a CWeapon class that derives from CItem; then maybe
CMeleeWeapon and CRangedWeapon would be subclasses of CWeapon. These
classes would have various methods allowing them to be picked up,
dropped, etc. and properties indicating weight, damage, etc.
Then you could have a CCharacter class, and as a field in that, have an
array of (references to) CItems representing the character’s inventory.
You could also have a field holding a reference to the currently wielded
weapon on the left hand, and another for the right hand. A method on
CCharacter would exist to equip a CWeapon from the inventory, which
would check which hand(s) it is for and set the references
Mmmmmmmkay… i didn’t understand most of that but i will get my
computer science teacher to help me out with that. Thanks Reed.
Not to bash you but… that is why people always suggest beginners to
start with simpler games (tic-tac-toe, tetris, etc).
After you make some simple games, you get enough knowledge to at least
understand what people are saying above.
I’ve made tic-tac-toe, pong, a small scale RPG, asteroid dodge, copter,
and games of the such but, in my class we did not have the time to go
Heh. That’s fine, but you really need to slow down and take a few more
basic CS courses before you think seriously about doing a large project.
Learning the tools of the trade actually is important. Right now it’s
kind of like you’re trying to build a car with just a wrench and a
screwdriver, if you see what I mean. :)
Oh i see exactly what you mean, but i am a very ambitious(if thats the
right word) young man and I do rather enjoy just jumping into the larger
things then taking it slow.