creating objects to fill arrays
by rory sampson · in General Discussion · 04/18/2011 (6:46 pm) · 0 replies
howdy,
I'm currently working on a game where blocks ( all the same dimensions but of varying colour) spawn from the top of the screen and fall down to the player who then catches these blocks and then repositions and drops then down to a grid below him,( i am not using physics at all)I plan to use an array and create (or spawn)a block up the top then have it check the position below it, if "empty" the block copies itself to the "empty position" and erases the previous position thus appearing to be moving down, My questions is , can i create a class of blocks containing many blocks of different colour and when the create block is performed it randomly picks one of these blocks to initialize and whats the best way to go about this?
secondly whats the best way to check for something in an array, should i give that position a state of empty and check if true or false? also could somebody link me to some "good" references on calling objects as well as removing game objects/destroying scene objects. i think most of my issues stem from not knowing the language well enough.
thanks,
rory
I'm currently working on a game where blocks ( all the same dimensions but of varying colour) spawn from the top of the screen and fall down to the player who then catches these blocks and then repositions and drops then down to a grid below him,( i am not using physics at all)I plan to use an array and create (or spawn)a block up the top then have it check the position below it, if "empty" the block copies itself to the "empty position" and erases the previous position thus appearing to be moving down, My questions is , can i create a class of blocks containing many blocks of different colour and when the create block is performed it randomly picks one of these blocks to initialize and whats the best way to go about this?
secondly whats the best way to check for something in an array, should i give that position a state of empty and check if true or false? also could somebody link me to some "good" references on calling objects as well as removing game objects/destroying scene objects. i think most of my issues stem from not knowing the language well enough.
thanks,
rory
About the author
game developer/student/copy paste programmer