Hey guys I was trying so hard to avoid this because I have asked so much questions in these fourms already =p but I am a poor programmer and got stuck being the lead programmer for my team in school since they all dont know a lick about programming.
Basically we are creating a simulation where animals breed and each time they breed it would produce a offspring with peices from each parent. I have it set up for testing purposes u control the giraffe and when you intersect with the bear it will choose from a array between a bear head/giraffe head and bear body/giraffe body producing a offspring which is completely random.
Now the idea was once the offspring is produced I would need him to be able to move randomly at will, however I cant figure out to make him move. I am calling these heads/bodies from an array and they are being drawn but I have no idea how to make them move since they are being implemented through a class.
so here is the code broken down
in draw I say
if (giraffetigersex == true) { giraffetigeroffspring.display(); giraffetigeroffspring.move(); }
and its the same exact thing for body and the others except for body its interface Body and class BearBody implements Body and all the other animal parts have the same class
The problem I am having is when I call the sex to be true it just displays it and thats it, it just draws it. I have no idea how I can some how combine these parts ex:Body and head* and have them move randomly together, so when my two animals intersect and produce the offspring, the offspring being drawn will be grouped together and move together randomly
ughh I am sorry this is long and I dont know if its complex, I am pretty desperate at this point and my team is completely clueless, if anyone could please help me I would be so thankfull:)
sorry and thankkk you in advance!!
Now all of it works, the function calls a random image from my array and displays it once. My question is:
Is there a way to make it so I can call only a few images instead all of them. For example can I make it so it randomly chooses between image 0 and 3 instead of all of them.
Hello I asked this question earlier but I think I put it on the wrong post so my apologies if I am repeating the same question, I will delete the other post:)
Anyway I have an array with random shapes I call via class I created my problem is when I choose to draw the random shape I have choosen it keeps picking a random shape then drawing it over and over again. I know the draw method is a loop, but I just cant figure out how to make it draw just one shape once instead of looping any help please
int numshapes = 3; Shape[] shapes = new Shape[numshapes];
void setup() {
shapes[0] = new Rectangle(); shapes[1] = new Circle(); shapes[2] = new Lined();
size(800,800); }
void draw() {
shapes[int(random(0, shapes.length))].draw(); }
interface Shape { void draw(); }
class Rectangle implements Shape {
void draw() { rect(25,25,25,25); } }
class Circle implements Shape { void draw() { ellipse(25,25,25,25); } }