Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Wenzil

Member Since 01 Aug 2012
Offline Last Active Oct 28 2014 02:09 PM

Posts I've Made

In Topic: Using global variables - really so bad?

05 October 2013 - 11:51 AM

Inject the sound system in Level1's constructor.
 
public int main()
{
  SoundSystem* soundSystem = new SoundSystem();
  Level1* level1 = new Level1(soundSystem);
}

class Level1
{
private:
  Player player;
  SoundSystem* soundSystem;
public:
  Level1(SoundSystem* soundSystem) : soundSystem(soundSystem)
  {
  }
  void Logic()
  {
     if(something) soundSystem->Play("shot.wav");
  }
};


In Topic: OOP Newb: Am I doing this right?

05 April 2013 - 06:49 PM

This is just a general OOP guideline, but it fits this particular example very well. According to Law of Demeter (see http://en.wikipedia.org/wiki/Law_of_Demeter), the clients of your Player class (in this case, Game) should not know about the Sprite subcomponent. So in your Player class you would have a Move(float x, float y) method defined like this:

 

void Player::Move(float x, float y) {
    sprite.move(x, y)
}

 

Then, inside Game.cpp, instead of moving the player's sprite directly, you just tell the player to move, and the player will take care of moving its sprite.

 

Similarly, you should define the Player constructor to set the sprite's origin and initial position, instead of having Game.cpp do it.

 

 


In Topic: Looking for completely honest feed-back

24 February 2013 - 12:40 AM

I'm no musician so I can only give an opinion: I like it a lot!

 

I feel like the first piece could start at the 1 min 12 (or 16?) second mark and be totally awesome all the way through. 0:00-1:12 has its moments but I feel like its missing something, too repetitive maybe?

 

The second one is perfect from what I can hear. Nice job :)


PARTNERS