c++ item tutorial

Post all your tuts or request for tuts here.
Post Reply
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

c++ item tutorial

Post by ZeroComp »

simple c++ item tutorial for those new to this

item properties code

Code: Select all

struct item_data
{
   std::string   name;
   std::string   description;
   unsigned long value;
   unsigned long weight;

item class

Code: Select all

class item
{
public;
  typedef unsigned long key
   item(key_type() const;
   const item_data& properties() const;
   static void define(key_type, const item_data&);
};
I will ad more later I will add things like how to program packages of items like i.e armor sets weapon sets how to include certain weapons in it and much more hope you like it and I hope it works!
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
User avatar
Perry
Posts: 409
Joined: Tue Jun 23, 2009 4:26 pm

Re: c++ item tutorial

Post by Perry »

You forgot to close your struct with }; .
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

Re: c++ item tutorial

Post by ZeroComp »

oh stupid mistake I apologize. :oops:
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
User avatar
Perry
Posts: 409
Joined: Tue Jun 23, 2009 4:26 pm

Re: c++ item tutorial

Post by Perry »

Its cool everybody makes mistakes. Just telling you because it can cause some freaky errors that will make you stay up til 4 am trying to fix... not that I would know or anything. :oops:
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

Re: c++ item tutorial

Post by ZeroComp »

:lol: thanks
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
pvtlink
Posts: 6
Joined: Thu Oct 15, 2009 11:07 pm

Re: c++ item tutorial

Post by pvtlink »

instead of just writing code, can you explain it so i actually know how to use it. thanks :)
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: c++ item tutorial

Post by Jackolantern »

I think this was maybe meant to be a small part of an on-going tutorial, as there is not really much there. It just creates a struct (a value-type data structure) and a class. It doesn't do anything.
The indelible lord of tl;dr
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

Re: c++ item tutorial

Post by ZeroComp »

I never continued :oops: I completely forgot but yeah in C++ just use this and fill in the fields with the item info and insert it in your code and you have an item which you can manipulate with your game source code
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
Post Reply

Return to “Tutorials”