R0J0hound's Forum Posts

  • This topic could be useful:

  • It was done with perlin noise, or more precisely a creative combination of multiple perlin noise.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • jogosgratispro

    Not very I'd imagine. This terrain is based on an idea that mudmask linked to. It just randomizes the array then smooths it for a island like look. Side view stuff is probably better done with perlin noise I'd imagine.

  • MathNook

    The simplest way would be to use perlin noise instead of an array of random values. There's a noise plugin that can help with that. Not sure if the example can be tweaked that way.

    Another idea is to loop the array. Basically you have a front index and a back index. You start with the array filled and back as 0. Front is the current position. Once it's a certain distance from back, the value at back is set to a new random value and one is added to back. Or something like that. I'd probably start from scratch since the idea is different enough.

  • Without a capx it's hard to come up with a solution. You could get it all in one go with a loop

    repeat RegexMatchCount times

    --- dictionary: add key RegexMatchAt(loopindex)

    To make it so it doesn't stop at the first occurrence you could use "g" as the flags parameter. That way you wouldn't need to replace the text and make the regex need to process the text again.

    There may be other ways to do it. Maybe this could give ideas:

  • How are you getting the string into construct? Pasting it into a variable? Or is it happening when loading a file from Ajax?

  • Newer versions of the chipmunk library can have segments collide with segments, but it wasn't ported to JavaScript when I made the plugin.

    I'm guessing you got that error because the inertia was set to zero. Maybe because of zero area. Just make it a hair thicker.

  • MathNook

    That's all the terrain that was generated, and after that it goes to 0. Changing the size of the array will change how much is generated.

  • You can do more but it starts to look hairy.

    op="+" ? var1+var2:(op="-" ? var1-var2:(op="/" ? var1/var2:(op="*" ? var1*var2:sqrt(-1))))

  • Without families you can't pick two separate instances to pin them together. You'd either have to have two different object types and alternate them on the chain or do the pin manually with events.

  • You have to write it like this:

    (MathOpIndex = 1) ?VarX1*VarX2 :VarX1/VarX2

  • Here are some topics I found on the matter:

    There are probably more. The gist of what happens is the wait delays the following actions till later, the function ends, and when the actions finally run the parameters are no longer there.

    The cleanest solution is probably not to use that wait 0 trick at all. The events in your pic can be made like this and operate the same.

    every 4 seconds

    --- create sprite at random location

    --- call function "detect"

    on function "detect"

    --- sprite: set blend to source out

    But in the context of what you want to do you can pass the uid to the function and you can pick the new sprite "by uid" and you can pick the rest of the instances with "pick all". To make things simpler a family can be used like below:

    // family "otherSprite" with object type sprite

    every 4 seconds

    --- create sprite at (random(640),random(480))

    --- call function "detect" (sprite.uid)

    on function "detect"

    sprite: pick by uid function.param(0)

    while

    sprite overlaps otherSprite

    --- sprite: set position to (random(640),random(480))

    And just for completeness if you want all the instances to be picked you can set variable or enable a group to run events. There's an example for zordering in the bottom of the post here:

  • Usually a family is needed to do that. Look here for an example:

  • If you have the text in a var you can remove the " with:

    set var to replace(var, """", "")

  • pick by uid can pick the new objects at any time. It is the exception to the rule.

    Functions and "on created" are run as if they were placed where the object was created or where the function was called. So no, they are not top level. For example:

    this:

    +-------------------+
    | on function "move"| sprite: set x to self.x+32
    +-------------------+
    +-------------------+
    | on sprite created | sprite: set opacity to 50
    | pick all sprite   |
    +-------------------+
    +-------------------+
    | start of layout   | create sprite at (0,0)
    |                   | call function "move"
    +-------------------+[/code:rahmbimr] is the same as this:
    [code:rahmbimr]+----------------------+
    | start of layout      | create sprite at (0,0)
    +----------------------+
       +-------------------+
       | pick all sprite   | sprite: set opacity to 50
       |                   | sprite: set x to self.x+32
       +-------------------+[/code:rahmbimr]
    
    For the case of needing to do something to all the instances right after a new instance is created I usually use a   variable or a group that i set or enable when i need to do something.
    
    global number zsort=0
    
    sprite: on created
    --- set zsort to 1
    
    start of layout
    --- create sprite at (10,10)
    
    zsort=1
    --- sprite: sort
    --- set zsort to 0