AndyWatson's Forum Posts

  • r85 shuts down the background music and pauses the game when I minimise the app using the home button; most of the time.

    If I keep playing and minimising it, it won't catch it after about 10-20 times and the music keeps on playing when the app is backgrounded. When I close the app and restart it's fine again, until I keep playing and minimising 10-20 times again. This is with a Samsung Galaxy S2.

    Also, if I let the screen go dim or lock the screen, the music keeps on playing. That's an instant reject on Amazon Appstore.

    However, if someone calls the phone, the music stops and the call can be answered. Once the call is killed, the game comes back into the foreground. This is cool!!

    ...a couple of snaggings, but almost there as far as I can see...

    Amazon testers use a number of different devices, so I may submit the version I've built in r85 once I've cleaned it up a bit and see what their verdict is, though I think the screen dim issue will cause a rejection straight away.

  • I did have a lot of problems with high latency audio and phonegap a few builds ago, where the game froze when it couldn't find sound files, but all has been fine for a while.

    ...except music not shutting off when the app goes into the background, but that may have been fixed in r85, I haven't had time to explore. I'll check how it's working for me in r85 tonight.

    Amazon has rejected my apps in the past due to the app not performing 'elegantly', but I was finally approved mid last week, though I had to remove the background music to achieve it (sound effects still embedded and working fine though).

  • Interesting read, thanks

  • Hi, i put the code in the index.html file, just before the </body> tag. It's the web code from admob that i embed.

  • Hi All,

    I thought this article may be of interest to some of you, looking at social, mobile and online gaming, the diversification of platforms and the role of HTML5 - check it out:

    Here's the article

  • Here's me

    <img src="http://a0.twimg.com/profile_images/641583130/andy1.jpg" border="0" />

  • Same thing happened to me.

  • Thanks for this. The reason for doing it is phonegap to android. When the app goes to backround the music keeps playing. I've tried loads of ways to add a phonegap event listener in the index that mutes music in the javascript when backgrounding. I can't seem to switch it so am resorting to running music from the index that plays and mutes depending on the value of a variable fired from the c2 javascript file. All other sounds will stay within c2.

  • Thanks for this, much appreciated - you got further than i did. Now you've given me that pointer i'll see whether i can get it to do what i need.

    Cheers!!!

  • Thanks for this, I'll check it out in detail, though am hoping to do it without any additional plugins.

  • Hi All,

    A bit difficult to explain this one...

    I want to include a script within the index.html file that looks at a variable that C2 has saved to my localStorage and then plays a music file if the variable=1. Does anyone know how to do this?

    I need to play the music file separate from the game and the runtime javascript. I hope someone can help...

    The audio file absolutely needs to play outside the c2runtime.js file.

    If the variable is called MyVar, I guess it's going to be something like:

    <script>

    if localStorage.MyVar=1

    then play musicfile.ogg

    </script>

    ...but evidently my expertise does not stretch this far - can anyone with programming skills help???

    Thanks in advance!!

  • Hi All,

    Now that the audio is working in the PhoneGap export (yay!), I'm trying to get my looping background music to pause when the Android app is minimised/backgrounded. Anyone know how to do this?

    I think it's something I need to put in the following code in the index.html to mute or pause the music file.

    <font color=green>document.addEventListener("pause", onPause, false); </font>

    <font color=green>function onPause(){ }</font>

    As an interim measure I have used:

    <font color=green>document.addEventListener("pause", onPause, false);</font>

    <font color=green>function onPause(){ </font>

    <font color=red>navigator.app.exitApp();

    } </font>

    to completely kill the app (and hence the audio), but it isn't an elegant solution. Any help or suggestions gratefully appreciated, I've been working on this for a few days and can't find any assistance online either.

    Many, many thanks!!

    ...an alternative would be to put the entire app into a paused state (including the music) - which would actually be an even better result!

    I've asked on the PhoneGap Build forum too.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi, i don't have my pc booted at the moment, so can't check, but i used galaxy s2 dimensions and full screen settings were scale to fit. i used the manual info to maximise performance for mobile. hope this is useful!

  • Heh, heh, cheers guys! Really enjoyed putting it together, now gonna get on to the next game. Loving Construct 2