royibernthal's Recent Forum Activity

  • Is it possible to spawn an object dynamically from within a custom plugin? Similarly to the official action Misc->Spawn another object (which I can't find in commonace.js)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm passing a Sprite instance to a custom plugin I'm making, when passed I try to change its frame. I also tried changing its frame a few seconds later and got the same results.

    Here's the function I'm passing the Sprite to in my custom plugin.

    Acts.prototype.SetSprite = function (sprite)
    {
          if (!sprite) return;
          
          cr.plugins_.Sprite.prototype.acts.SetAnimFrame.call(sprite, 2);
    };[/code:1t1fb5x5]
    
    Here's the error:
    
    [code:1t1fb5x5]Uncaught TypeError: undefined is not a function
    
    http://localhost:50000/Sprite_plugin.js, line 1529 (col 9)[/code:1t1fb5x5]
    
    The function itself is called successfully, but the error seems to refer to a function call in Sprite/SetAnimFrame.
    
    Any idea what's going on?
  • 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();

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

    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");
    	};[/code:1j3q2uvw]
    
    Same error:
    
    [code:1j3q2uvw]Uncaught TypeError: undefined is not a function
    
    http://localhost:50000/Sprite_plugin.js, line 1529 (col 9)[/code:1j3q2uvw]
  • Yeah looks like this could indeed help me.

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

    Acts.prototype.SetSprite = function (sprite)
    	{
    		if (!sprite) return;
    		
    		cr.plugins_.Sprite.prototype.acts.SetAnimFrame.call(sprite, 2);
    	};[/code:1m9blwcg]
  • Yeah I am going to need extra variables and functionality for each individual sprite, which is why I'm going to use a behavior for that specific part like you suggested.

    There's still the bigger picture though to think about.

    Not sure I understood what you meant in your second sentence. Could you please rephrase / give an example?

  • It's better ofcourse than doing it with a plugin, but as it is now it'll require me to do alot of repetitive work.

    I'd like to have something that'll contain and control a FEW instances of sprite.

    I'd like to have a few separate instances of that something, that have the exact same functionality.

  • Yeah, it'd save me having to pass the sprite to a plugin in an action. Anything else other than that?

  • Tekniko - It seems like something I must think about beforehand, otherwise it'll probably be a headache to adjust the whole game to a different resolution later.

    I'm in a slightly more complex position than simply getting the game out on one device first, I must make sure that cross-platform is possible.

    notnsane - Could you please elaborate on that with examples?

  • How'd it look like with behaviors (logic-wise)?

  • I'd like to develop a game that'll be available on all platforms (mobile, ipad, pc, etc...).

    What resolution would be best for that? Should I have different graphics for each screen size? (e.g. different graphics for mobile and pc)

  • I'm not sure what's the best way to approach it, the way I have in mind seems too inconvenient.

    I'd like to have a plugin that contains and controls sprites. I'd like to have a few instances of that plugin.

    Should I create a couple of sprites for each instance of the plugin and pass them to it? (and have a few instances of the plugin manually as well)

    Is that how I should approach it in Construct 2? Isn't there a more convenient way? Perhaps somehow create instances of sprite dynamically inside of a dynamically created custom plugin?

royibernthal's avatar

royibernthal

Member since 1 May, 2014

None one is following royibernthal yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies