- Home /
Help with storing and recalling choices
Okay, I''m making a battle system similar to a game called Fate Extra: http://www.youtube.com/watch?v=1eH5tPZ_lzs&feature=related
It's basically rock-paper-scissors taken up a notch. I've gotten the engine working to where it can select one of three options, but I can't get it to select and store up to 6 individual choices and then compare them with the computer's choices made via a random function in order.
Any help with that?
Answer by RampantStudios · Mar 06, 2011 at 11:59 AM
It sounds to me like your after an Array to store your data.
using System.Collections.Generic
public List<int> selectedItems = new List<int>();
public void AddItem(int Selection) { selectedItems.Add(Selection); }
public void CheckItems() { foreach(int outInt in selectedItems) { //Your stored values will be looped over here. print(outInt); } }
There may be some errors in that code, I wrote it directly in the text field.But arrays are the way to go!
I figured arrays would be best but I need to know how to arrange it to compare. Plus, it's hard to read in C#
Well the way to compare would be to check each integer against the other in two loops, I'm no sure what sort of comparisons you'd want to do though :D
In all honesty, I'm not the greatest Javascript programmer, anyone out there got the conversion for the above code?
Your answer
Follow this Question
Related Questions
battle scripts 1 Answer
How to make characters for a turn based battle system efficiently? 0 Answers
Hexagon A* Pathfinding - limiting path length 0 Answers
Need help making a pokemon turn based system ! 1 Answer
Turn Order 2 Answers