shalmu's Forum Posts

  • I can't find it in a list of modes.

    It's not there because multiplication is slower that addition for "Additive"?

    How can I emulate "multiply"?

  • Is it possible to create local variables inside a group that won't be recreated on each tick?

    By far what I see is this:

    I create a local variable in a group "foo = 5",

    then, in the same group "System -> on every tick", I do "foo+=5"

    after that I use this variable and expect it to increase by 5 on every frame.

    But all I have is 10 every time!

    The solution to this is to make this variable global, but I don't want to produce global variables, actually I want to avoid it whatsoever.

  • Sorry guys, I didn't mean to offend anyone.

    rexrainbow, I will try to explain in simple words:

    refactoring has nothing to do with "optimization for speed". Generally it is about a structure of code, it is when you move some parts of code to other parts, making the code more clean, but keeping the execution speed the same. For example, you work on something for a week and suddenly see that you have one huge class and many other small classes. Then you realize, that this class wants to do too much! After that you analyze this class and see if there are more than one entities (like topics, themes) to it. If you see, that there are 5 "topics", you split it to 5 different classes. This is an anti pattern, which is called "God object" in programming. There are many other "anti patterns", for example "Feature envy class", is when you have two classes and one of them uses too much features of another one. It is a sign for you that you probably should move some features from the second to the first one.

    You can read more here: en.wikipedia.org/wiki/Code_refactoring

    Here is a page about "God object": en.wikipedia.org/wiki/God_object

    So I thought something similar can happen to Event Sheets, because those are lists of logic entities, which is very similar to code files in many senses and when you create big games with 25 Event Sheets, with 100 groups and 200 functions, there is something to refactor too. Or is there?

  • rexrainbow, you would have received many negative reactions on StackOverflow with your "very meaningful" answers...

    Do you know what "refactoring" is or you reply just to reply?

  • That's a pity, especially knowing how easy it would be to implement such a thing.

    And generally I can see that C2 is not optimized for JS SDK devlelopers, the "Event Sheeters" are first citizens here...

  • digitalsoapbox, do you mean there is no such feature in C2? Sure?

  • I am developing some plugin in WebStorm, but everytime I need to test it I have to switch to C2, press f5, which is annoying.

    But I can set "Run" command in my WebStorm, using, for example, command line.

    Is it possible to Compile C2 project from command line?

  • When a project grows bigger, you have many event sheets, you start to contemplate about refactoring it.

    Well, I know how to refactor code, I usually follow all Martin Fowler's recommendations and it works perfectly fine for many years. But now I am looking at one huge project, and it's obviously unbalanced, so I have two questions:

    • Are there methods, best practices, anything related to refactoring event sheets?
    • Are there any known anti patterns in event sheets, that were noticed by C2 community?
    • Are there "Event Smell", like we have "code smells" in programming?

    Thank you.

  • Nonono, what I mean is when you have created a sprite with, for example, 5 different named animations, like "Idle", "going", "jumping", etc., and you want to export the entire sprite with all those animations as a separate file - is this kind of thing possible to do?

  • The only method I see now is to ask animators to prepare things in a separate project "animations", open both working project and "animations" then copy/paste sprites from one to another.

    Is there an ability to export those the same way we do with plugins? To some kind of ".c2sprite" file?

  • there isn't much we can do about that.

    What about using an existing rendering lib, like pixijs.com They claim it's a "2D webGL renderer with canvas fallback"

    Or two.js: "It is renderer agnostic enabling the same api to draw in multiple contexts: svg, canvas, and webgl."

  • I can't believe you still don't have this possibility since 2012

    • What if I have a lot of diffirent aces, and I would like to split them to keep them in different files?
    • What if I have a huge drawing system that I want to keep in a separate file?
    • What if I have the same chunk of code that I want to use in 5 different plugins?

    I realize that edittime works in a pure V8 context, but there are pure V8 libs, like Node.js, that allow to use require.

    I was hoping it's gonna work in Construct, tried to separate the drawing stuff, wrote this:

    var draw = require('./drawEdit');
    draw.draw();[/code:2hql0u53]But it wouldn't work.
    
    Any thoughts about it?
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley, I merely saw it in a video tutorial about "How to create a Grid plugin".

    Does it mean (I ask for the sake of good coding practice) that I have to write two different chunks of code that do the same thing in those two methods? Or should I only rely on webGL and skip the "draw"?

    What I do right now is I write this:

      var sorryShown=false;
    	instanceProto.drawGL = function (glw){
        if(!sorryShown){
            alert('Sorry, but this plugin cannot be used with WebGL on.\n'
                +'To turn it off, go to Project->Enable WebGL and set it to "Off".');
          sorryShown=true;
        }
      };[/code:3vdzbl64]
    So that people won't wonder why nothing happens if they are in GL mode.
    
    Or maybe I could take advantage on a cross-context lib, like Two.js?
  • Alright, so to draw anyway, I do this:

    instanceProto.drawGL = function (glw){
        this.draw(this.runtime.overlay_ctx);
    }[/code:kw3xbeg3]
    but in this case .draw()'s parameter "ctx" is null...
    How can I pass the real 2D canvas to .draw?
    I tried "this.runtime.canvas" as well as "this.runtime.overlay_canvas" - nothing is working...
  • I am doing the simplest tutorial:

    goo.gl/20ixH0

    but it won't execute "draw" method, no matter what I do.

    I even put "alert(111)" inside the body of the function, it won't fire.

    Any ideas?