KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am creating a game that lets the player enter input, changes some states, then checks if a "goal value" is true (obviously this description is muchly simplified), and I want to be able to have that goal value be anything from if the players life is below a certain value to if the amount of enemies remaining is equal to zero. Is there any "expression class" that can hold a simple "value1 compare-operator value2" and check it? ie: expression goal(x = 4); if not, does anybody have any suggestions as to how I could develop an expression class? EDIT: another (more towards what I am trying to achieve) example: game.init(){ expression goal = FileRead(goalfile); } game.checkstate(){ if(goal) exit(1); } //exit 1 is the games win state //another more specific eg.: class level1 { public: expression goal(total_enemies == 0); }; class level2 { public: expression goal(player.x == goal.x && player.y == goal.y); };
Tags (comma-separated)
Save Edits
Cancel