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

62729b540737c9893b8005b272fa96fa
0
Leaf 101 Oct 29, 2013 at 12:33

hello

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: http://devmaster.net/assets/post/2844/uploads/devmaster_intro-to-c-tmpl83.00c_oct14.zip. 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 )
{
  	m_Screen->Clear(0);
   	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.

Fdbdc4176840d77fe6a8deca457595ab
0
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.

62729b540737c9893b8005b272fa96fa
0
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?