Game Dev

Tutorials

When starting the game for the first time, the player will start with the tutorial. It will be the first thing to complete even before reaching the title screen.

This tutorial will teach the player how to do the main actions:

  • Move
  • Use the sword
  • Use the gun
  • Dash

Here is a first version :

After crossing the bridge, a first cat will appear. Defeating it will end the tutorial. I’m working on that!

There are more skills to learn though, such as how to:

  • Trigger super attacks
  • Use perks
  • Stun enemies
  • Break armors
  • Break shields
  • Pilot mechas

But I guess the player will have to experiment those by himself.

Advertisements
Misc

Debugging an Android app

Hey there,

I’ve been debugging my Unity app using “popups” the whole time… Truth is I was too lazy to look for an other solution.

Last week I integrated OpenIAB (pluggin for app purchase) and my app crashed again and again at launch.
After some “google-ing” I figured out, actually, I could get a debug console pretty easily !

– Connect your Android device
– Go to your Android SDK folder, then “platform-tools”
– Run a “cmd” there
– Execute “adb logcat”

And it’s all done ! Really essential !

Game Dev

MediaPlayer class

I checked some things about the submission process lately, and I discovered the way I played musics would just help me to fail the certification…

I used to play music that way (not my actual code, it’s just an example) :

SoundEffect soundEffect = content.Load<SoundEffect>("Sounds/mySong");
SoundEffectInstance songInstance = soundEffect.CreateInstance();
songInstance.IsLooped = true;
songInstance.Play();

Well, it worked fine, and I guess using it to play songs on PC or Xbox 360 is not a problem… But the issue is, on a Windows Phone, if the user is playing his own music it will just play both the user’s music and the game music at the same time. And looks like it’s not allowed.

So I read we should use instead the MediaPlayer class to check if the game has the control or not (which means if the user is using the media player or not…). But we still can prompt the user when the application is launching to ask if he would like to hear the game’s music instead of the one he’s listening. Then, I changed it into something like :

if (!MediaPlayer.GameHasControl)
{
   IAsyncResult guide = Guide.BeginShowMessageBox(
   "Warning", "Do you want to play the game's music instead  
   of the one you are listnening ?", new string[] { "YES", "NO" }, 0,
   MessageBoxIcon.Warning, null, null);
   int result = Guide.EndShowMessageBox(guide);
   if (result == 0) // YES    
   {
        Song songInstance = content.Load<Song>("Sounds/mySong");
        MediaPlayer.Play(songInstance);
   }
   else // NO    
   {
   }
}


The other thing is with the MediaPlayer class we can play mp3 songs... I could only play wav with the SoundEffect... Cool then. That's an important improvement !

Source : http://benkane.wordpress.com/2010/11/23/how-to-play-music-in-xna-games-on-windows-phone-7-and-still-pass-cert/