Instances of a plugin that contains sprites

For developers using the Construct 2 Javascript SDK

Post » Mon May 05, 2014 9:49 am

Yeah looks like this could indeed help me.

I get an error though: "undefined is not a function"

Code: Select all
Acts.prototype.SetSprite = function (sprite)
   {
      if (!sprite) return;
      
      cr.plugins_.Sprite.prototype.acts.SetAnimFrame.call(sprite, 2);
   };
B
5
S
1
Posts: 28
Reputation: 431

Post » Mon May 05, 2014 10:11 am

Do you put one sprite object in this project?
You might check if (cr.plugins_.Sprite != null) first.
B
109
S
27
G
276
Posts: 4,479
Reputation: 154,418

Post » Mon May 05, 2014 10:26 am

Yes I do put one sprite in this project, which is the sprite that I'm passing to this function.

Code: Select all
Acts.prototype.SetSprite = function (sprite)
   {
      if (!sprite) return;
      
      if (cr.plugins_.Sprite != null) cr.plugins_.Sprite.prototype.acts.SetAnimFrame.call(sprite, 2);
      else alert("No Sprite");
   };


Same error:

Code: Select all
Uncaught TypeError: undefined is not a function

http://localhost:50000/Sprite_plugin.js, line 1529 (col 9)
B
5
S
1
Posts: 28
Reputation: 431

Post » Mon May 05, 2014 11:05 am

I am not sure, I only could tell that I had made some plugins which access the ACE interface of plugin directly.

For example,
https://github.com/rexrainbow/C2_plugin ... runtime.js

This plugin will access the condition, action, expression of webstorage object.
B
109
S
27
G
276
Posts: 4,479
Reputation: 154,418

Post » Mon May 05, 2014 11:26 am

Any chance you'll try to help me figure out what's wrong with the Sprite's case?

The function that is undefined is in the Sprite plugin and it's not the function I'm calling but a function call inside that function: this.doChangeAnimFrame();
B
5
S
1
Posts: 28
Reputation: 431

Previous

Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests