Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Chapter 05] KamaKazi Base code
#8
Okay, I have had a bit of success.

Using the same code I sent you, I was able to get single random traveling blinking star to appear.

The first thing I had to do was remove the '#include "Game.h"' from Star.h since when adding Star.h to Game.h this creates a circular reference and fails to compile.

In Game.h i created a reference to a Star object:
Star* MyStars;

in the GameInit method, i added an initialization for the MyStars object under the other references.

MyStars = new Star();

In Game::Update, I added a call to the Stars Update method under the AlienGroup->Update call;

MyStars->UpDate(this);

Then under the loop for Game::MyObjects I added a call to the Star Draw method.

MyStars->Draw(a_Screen);

This compiles and runs without a SigFault and produces a single Star that blinks and changes different colors as well as travels down the screen at random locations once it gets to the bottom of the screen. The thing I am missing is having a screen full of stars but it is a bit closer.

Should I be using Game::MyObjects for these?

Also, is the right place for this posting or should it go under "Help my code won't work??"?
Reply


Messages In This Thread
[Chapter 05] KamaKazi Base code - by jomoengineer - 11-13-2018, 07:57 AM
RE: [Chapter 05] KamaKazi Base code - by jomoengineer - 11-17-2018, 02:57 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)