I've tried the Composite references and I might be missing it, but I'm can't find how to address an object that was created inside another object.
I have a class called bSprites that I've designed to work almost exactly like movieclips in actionscript (it's what I'm comfortable with).
So playing around I've created a class called 'ball'. Originally I extended bSprite with ball but it makes some of my other code less elegant (all sprites are added to an array, a for loop walks through the array and updates/draws/etc all the sprites. Having ball extend sprite means I had to add another array and for loop...)
Now I'm:
Code:class ball{
bSprite base;
bSprite shade;
bSprite shadow;
float _x;
float _y;
float _xspeed;
float _yspeed;
ball (float tempXpos, float tempYpos, float tempXspeed, float tempYspeed){
_x = tempXpos;
_y = tempYpos;
_xspeed = tempXspeed;
_yspeed = tempYspeed;
shade = new bSprite("dbc.png", _x,_y,_xspeed,_yspeed);
base = new bSprite("dbb.png", _x,_y,_xspeed,_yspeed);
shadow = new bSprite("dba.png", _x+10,_y+10,_xspeed,_yspeed);
}
}
The problem is I don't know how to change the fields of the sprites I created in the ball (shade, base and shadow). Coming from actionscript I wanna do something like ball[shade]._x++, but obviously that doesn't fly.
Ultimately, I want all objects to be built of sprites and all sprites to be handled and controlled through a single set of statements (so I don't have to have an array for n types of sprites, since I'll also have arrays for object types).
Any advice?