Here's what I need in my structs. I need a player struct that contains x, y, exists, and frame. A bullet[#] struct that contains x, y, exists, and type. An enemy[#] struct that contains x[#], y[#], exists[#], type[#], and frame[#]. An enemy bullet struct that contains x[#], y[#], exists[#], and type[#]. My questions is out of the two examples I've shown which one is the best to use. I'm assuming that it's example 1, but the only reason for my doubt is because there are wasted integers for two structs. Both player bullets and enemy bullets aren't going to be using int frame. So which one is better to use.
example 1
example 2Code:struct PLAYERS { int x; int y; int exists; int type; int frame; }bullet[PL_MAX_BULLETS], player; struct ENEMIES { int x[MAX_ENEMIES]; int y[MAX_ENEMIES]; int exists[MAX_ENEMIES]; int frame[MAX_ENEMIES]; int type[MAX_ENEMIES]; }e_bullet[MAX_ENEMIES], enemy[MAX_ENEMIES];
*I'm not really sure why I'm asking this, because I already know it's example 1. I guess sometimes you just need reassurance... And btw, if anybody has a better example (idea) please feel free to share it.Code:struct BULLETS { int x; int y; int exists; int type; }bullet[PL_MAX_BULLETS]; struct PLAYERS { int x; int y; int exists; int frame; }player; struct ENEMY_BULLETS { int x[MAX_ENEMIES]; int y[MAX_ENEMIES]; int exists[MAX_ENEMIES]; int type[MAX_ENEMIES]; }e_bullet[MAX_ENEMIES]; struct ENEMIES { int x[MAX_ENEMIES]; int y[MAX_ENEMIES]; int exists[MAX_ENEMIES]; int type[MAX_ENEMIES]; int frame[MAX_ENEMIES]; }enemy[MAX_ENEMIES];![]()



LinkBack URL
About LinkBacks



