Yarram
2010-03-29, 08:08 PM
Note: Please Don't give me any source code, as that would be cheating.
I'm writing game for uni, without a GUI, which involves moving around an XY axis and eating food, while dodging stationary enemies that will kill you if you move within one square of them. Despite the fact that I can make the program perform perfectly, down to the last character, the universities marking system won't accept my assignment due to using different ways of achieving the same goal to what they want.
I'm not going to post my source, because that's cheating, but I will describe my problem.
I'm required to have 6 classes, Main, Game, UI, Player, Enemy, Food. Food, Player and Enemy objects all have X and Y variables.
I'm required to set these variables within the Game() constructor, which would be fine, but is stuffing me up, because I'm also not allowed to use arguments.
Is there a way of either creating an object within another object, and then consistently accessing it with other methods that the original object contains, or is there a way of calling upon the inside objects from within main(), or is there a way of accessing objects without requiring arguments?
Further Note: I'm not allowed to use "static," "inheritance," or any complex library methods because they're liek: "No you can NOT use prior knowledge to complete this assignment!"
I'm writing game for uni, without a GUI, which involves moving around an XY axis and eating food, while dodging stationary enemies that will kill you if you move within one square of them. Despite the fact that I can make the program perform perfectly, down to the last character, the universities marking system won't accept my assignment due to using different ways of achieving the same goal to what they want.
I'm not going to post my source, because that's cheating, but I will describe my problem.
I'm required to have 6 classes, Main, Game, UI, Player, Enemy, Food. Food, Player and Enemy objects all have X and Y variables.
I'm required to set these variables within the Game() constructor, which would be fine, but is stuffing me up, because I'm also not allowed to use arguments.
Is there a way of either creating an object within another object, and then consistently accessing it with other methods that the original object contains, or is there a way of calling upon the inside objects from within main(), or is there a way of accessing objects without requiring arguments?
Further Note: I'm not allowed to use "static," "inheritance," or any complex library methods because they're liek: "No you can NOT use prior knowledge to complete this assignment!"