can someone help me with the igad introduction to c++ part 10?

Leaf 101 Oct 29, 2013 at 12:33


I got stuck with the assignment for part 10. can someone help me? if you need the template i am using, it can be found here: the code i got right now is this one:

// Template, major revision 3
// IGAD/NHTV - Jacco Bikker - 2006-2009 
#define NUMBER_OF_TANKS 300

#include "string.h"
#include "surface.h"
#include "stdlib.h"
#include "template.h"
#include "game.h"

using namespace Tmpl8;

Sprite* MySprites[NUMBER_OF_TANKS];
int Xcoords=0;
int Ycoords=0;

void Game::Init()
// put your initialization code here; will be executed once
for (int index = 0; index < NUMBER_OF_TANKS; index++)
	MySprites[index] = new Sprite( new Surface("assets/ctankbase.tga"), 16 );

void Game::Tick( float a_DT )
   	for (int index = 0; index <NUMBER_OF_TANKS; index++)
   MySprites[index]->Draw( 0, 0, m_Screen );

also, sorry for the double post about this, the other one has gone lost in the mists of time(or something along those lines)

2 Replies

Please log in or register to post a reply.

dk 158 Oct 29, 2013 at 19:32

What are you stuck on exactly? You need to provide more details if you expect others to help you.

Leaf 101 Oct 30, 2013 at 09:09

this code generates 300 tanks on top of each other. i have to fill the screen with 300 tanks using arrays, what code should i add to do that?