1 min
For interacting with my items I had one way of doing it and implemented that. It involved having all the item interaction in the player cpp but my lecturer James said it wasn’t a very object oriented approach so I decided to switch it up. I put the data needed for the items in txt files similarly to my rooms. I then read the data in from the files and set up each item using them.
name = file.returnTxtData(0);
// any extra data stored in the item class;
// any extra data stored in the item class;
// any extra data stored in the item class;
// any extra data stored in the item class;
The code example sample is how I did it. I used the file system I created to read the data from the file and stored it all in a vector. The ‘file.returnTxtData(0)’ then returns the data located at the part of the vector asked for which is the ‘0’. This then returns the data which should be the item name if the txt file was set-up right.
Subscribe to this blog via RSS.
Low level programming dev diary 28
Text based adventure dev diary 6
Level design developer diary 3
Game engine programming dev diary 14
Audio-visual production dev diary 7
Audio-Visual Production: Particle System Mesh Spawning Issues
Posted on 20 Feb 2020Low level programming dev diary (28) Text based adventure dev diary (6) Level design developer diary (3) Post mortem (4) Ex-machina dev diary (11) Game engine programming dev diary (14) Network game dev diary (11) Audio-visual production dev diary (7)