Jump to content


Photo

Need help importing a JS and use it


  • Please log in to reply
4 replies to this topic

#1 haloflooder

haloflooder

    GMC Member

  • GMC Member
  • 35 posts

Posted 13 January 2012 - 08:37 PM

I'm trying to use SoundManager2 for the sound engine for my game but I don't know how to use the functions from this JS...
this.onready = function(oMethod, oScope) {

    var sType = 'onready';

    if (oMethod && oMethod instanceof Function) {

      // <d>
      if (_didInit) {
        _s._wD(_str('queue', sType));
      }
      // </d>

      if (!oScope) {
        oScope = _win;
      }

      _addOnEvent(sType, oMethod, oScope);
      _processOnEvents();

      return true;

    } else {

      throw _str('needFunction', sType);

    }

  };
How would I use this function in GM? I also tried to follow the tutorial but it didn't help me.
I put in the file in the extension area and I put in the function "onready" but it didn't do anything when I try to test it
if onready = true
    draw_text(32,32,"READY!");
Here is the link to the SoundManager2 project page
http://www.schillman.../soundmanager2/
  • 0

#2 Artaex Media

Artaex Media

    Artaex Media

  • GMC Member
  • 1531 posts
  • Version:Unknown

Posted 13 January 2012 - 09:34 PM

Why use a "sound-manager"?
GM has built in support for playing sounds on HTML5...
  • 0

#3 haloflooder

haloflooder

    GMC Member

  • GMC Member
  • 35 posts

Posted 13 January 2012 - 10:00 PM

Because of all these reasons:
1. Firefox doesn't loop music in GM's built in audio
2. if sound_isplaying doesn't work (bug)
3. More features from the JS
4. Music doesn't loop correctly with GM's built in audio
  • 0

#4 azcodon

azcodon

    GMC Member

  • GMC Member
  • 207 posts
  • Version:Unknown

Posted 16 January 2012 - 02:40 AM

you must call function js with two argument.
try this : if onready(oMethod, oScope) == true
draw_text(32,32,"READY!"); //must be event draw
  • 0

#5 haloflooder

haloflooder

    GMC Member

  • GMC Member
  • 35 posts

Posted 25 January 2012 - 04:04 PM

you must call function js with two argument.
try this : if onready(oMethod, oScope) == true
draw_text(32,32,"READY!"); //must be event draw

This didn't work... damn, now I really need this JS because I'm making a shooter game and GM messes up the audio a lot. lol
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users