R0J0hound's Forum Posts

  • You can either duplicate the play sound action to every place you set the text:

    every 1 second

    --- set text

    --- play sound

    or you could make a function to set the text and only use that:

    every 1 second

    --- function call "set text" ("foo")

    on function "set text"

    --- set text to function.param(0)

    --- play sound

  • It's from the origin of the object that is usually centered in the image editor. You could always add an imagepoint and use Sprite.imagepointx(1) instead of sprite.x.

  • I've tried a few ideas. One is to use a couple globals. For example i've used some thing like this to add three vectors together. (1,0), (2,3) and (5,5)

    global number rx=0
    global number ry=0
    on function "add"
    --- set rx to function.param(0)+function.param(2)
    --- set ry to function.param(1)+function.param(3)
    
    start of layout
    --- function: call "add" (1,0, 2,3)
    --- function: call "add" (rx, ry, 5,5)[/code:1bgzt7vv]
    
    I've also put things in a group and using static variables in cases where only functions in that group needs access. Here's a contrived example:
    [code:1bgzt7vv]group: "number print"
    		static number ret0=0
    		static number ret1=0
    		static number ret2=0
    
    		on function "print2"
    		--- function: call "3rand" ()
    		--- browser: console log : ret0&"."&ret1&ret2
    		--- function: call "3digits" ()
    		--- browser: console log : ret0&"."&ret1&ret2
    
    		on function "3rand"
    		--- set ret0 to int(random(10))
    		--- set ret1 to int(random(10))
    		--- set ret2 to int(random(10))
    
    		on function "3digits"
    		--- set ret0 to 3
    		--- set ret1 to 1
    		--- set ret2 to 4
    
    start of layout
    --- function: call "print2" ()[/code:1bgzt7vv]
    
    Another idea would be to implement multiple returns via an array used as a stack.  It would mirror how you'd do it in assembly language.  On possible example. The cleanup could prove tedious, but it probably could be abstracted away with more functions.
    
    [code:1bgzt7vv]on function "get 10 numbers" 
    repeat 10 times
    --- array: push random(1) to front
    --- function: set return to 10
    
    start of layout
    --- function: call "get 10 numbers"
    --- console log: "number of returned numbers: "&function.returnvalue
    --- console log: "first number: "&array.at(array.width-9)
    --- console log: "second number: "&array.at(array.width-8)
    --- console log: "10th number: "&array.at(array.width)
    --- console log: "cleanup"
    --- array: set size to (array.width-10, 1, 1)[/code:1bgzt7vv]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Using a boolean to indicate the first tick and then doing it in the tick function is a cleaner solution to me.

    behinstProto.onCreate = function()
    {
       this.firstTick = true;
    };
    
    behinstProto.tick = function()
    {
       if (this.firstTick)
       {
          this.firstTick = false;
          cr.plugins_.Sprite.prototype.acts.SetAnimSpeed.call(this.inst,0);
       }
    };[/code:3iyvjmxy]
  • I thought on changed is only triggered when the user types something in the textbox. If it would be triggered every time the text is set then we'd run into other issues such as an infinite loop if we made a condition like:

    on text changed

    --- set text to ""

  • You could use a system compare with the layoutname expression.

  • Use something besides sprite that can have a unique image per instance. I know tiledbg can, or maybe a canvas or paster object. I seem to recall a plugin called unique sprite that can do it too.

  • To see how fast your computer is compared to others you could use a benchmark like this one:

    https://www.passmark.com/

    As an example my computer is in the 25th percentile, which means 75% of computers are faster than it.

    You could show a recommended system requirements for your game like you see many titles do. I'd imagine they may test the game on a few computers first to get a better feel for it. Or you could just release the game and if you get a lot of complaints about performance you could attempt to optimize more.

  • If you set the text as the first index then you could just use the sort action.

    As is the first value is a number so it would be sorted like this:

    1,5,Grape

    3,6,Grape

    3,5,Pineapple

    5,7,Apple

    10,4,Grape

    but if you set the array up like this:

    grape,1,5

    grape,10,4

    grape,3,6

    apple,5,7

    pineapple,3,5

    then sort would do make it like this:

    apple,5,7

    grape,1,5

    grape,10,4

    grape,3,6

    pineapple,3,5

    Besides that you could implement your own sorting. "bubble sort" is probably the simplest to do just look at wikipedia for some psuedo code. But it's probably easier to just rearrange your data and use the sorting action.

  • The load image action replaces the animation frame which is used by all the other instances. You could create a bunch of tiny blank frames to use for this purpose. Basically just switch to one of them and load the image there.

  • You can use the delete action if you want to it to look like this after removing the x index starting with 3. All the y and z indexes with the same x will be removed too.

    1,6

    2,7

    4,9

    5,10

    Adding values to the array is simple as making the array size one bigger and setting the values at the bottom of the array.

    However if you want just the values directly below three to be shifted up like so:

    1,6

    2,7

    4,8

    5,9

    0,10

    Then you need to define and empty value like 0, and you need to shift it up manually.

    var x=4

    var y=3

    var z=0

    repeat array.width-x times

    --- set array at (x+loopindex, y, z) to array.at(x+loopindex+1, y, z)

  • Check the value of "self". It's saying that it can't get "trigger" from undefined.

    So my guess is "self" isn't the right value.

    self.runtime is probably undefined so you can't get further values.

    You can even use the browser debugger to stop at that line so you can inspect the values.

  • It appears to be a feature of chrome/nwjs that uses a color profile to adjust the colors. Here is a previous discussion on it or something very similar:

    As I recall if you look at the Windows display settings there is a color profile settings tab for the monitor that lists color profiles installed. It really just depends on if one was installed with your driver or not. You can remove them too.

  • You may be able to use distance joint to attach moons into orbit, and maybe remove the joints when something hits it.

  • Odin

    Only the part of the tilemap that is onscreen will paste, and since the player is offscreen nothing is drawn. That is done by C2 by design and under normal circumstances it reduces the render load. It isn't ideal for the paster plugin though. I found a workaround that involves leaving the paster object on screen and instead move the tilemap object.

    Such a workaround should probably be built in but I've lost interest in working on plugins unfortunately.