Just a quick one. I am writing a simple game where boxes will bounce around the screen and the player has to dodge them while to number of boxes increase and bounce all over the place. I can't put my structure into an array correctly. Help please?
#include <stdlib.h> //rand() and srand() use in main.
#include<allegro5/allegro.h> // Main Allegro header
#include<allegro5/allegro_native_dialog.h> // For native to OS message boxes
#include<allegro5/allegro_ttf.h> // Ability to laod true type fonts
#include<allegro5/allegro_font.h> // Needed for font functions
#include<allegro5/allegro_primitives.h> // Needed to draw shapes to window must call the correct init before use.
#include<time.h> // Need to set the seed for the randomized timer
#include<iostream> // incase I want to use cout << for debugging to the consolse window
#include<string.h> //Best container class to use instead of standard for string. Use of String function built in.
#include<vector> // Choosen Container Class will be using pushback etc to add and remove boxes.
usingnamespace std;
constint numofboxes = 1; // Initial Number of boxes 1 Array start from 0
typedefstruct boxes //my structure that I want to attach to my vector container / array
{
float red; // RGB colour of box.
float green;
float blue;
float x; // X , y coords of box top left corner
float y;
float boxsize; //size
float dx; // Box direction x
float dx; // Box direction x
float Speed; // Amount of pixel the box will move
};
vector<boxes>box[numofboxes];
box[0].x = 1;