R0J0hound's Recent Forum Activity

  • [quote:2tts55ja]How can i limit rotation of a curve path?

    I do not understand this question.

    If you want it to turn to the direction to move before moving then you'll have to do it manually with events.

    Maybe something like

    every tick

    --- sprite: rotate 100*dt degrees to target_angle

    Sprite: angle is within 0.5 degrees of target_angle

    --- sprite: move forward

  • Jermfire

    It could be the browser you use doesn't support webgl

    look here:

    http://get.webgl.org/

    For me on Firefox 30 I see:

    [quote:1lyb82wu]Your browser supports WebGL

    And the fluid example works.

    But on internet explorer 11 I see.

    [quote:1lyb82wu]Your browser supports WebGL

    However, it indicates that support is experimental; Not all WebGL functionality may be supported, and content may not run as expected.

    And the fluid example doesn't work.

  • capx files can be extracted with an unzip program to get at all the files inside. Sounds like something has been corrupted with it if it says a file is missing. Do you have any backups?

    What I'd try is extracting the capx to a folder, look in the "layouts" folder and see if there are any other xml files there. If there are you could try to copy one and rename it to Menu.xml. What that would do is copy a layout that is still there so you can at least open the project. Then go to the parent directory and open the .caproj file and see what happens.

    Best case you'd have a recent backup. Next best case would be the above steps would work and you'd only have to remake your menu layout.

  • By material I mean rock/dirt/air/etc... In the array it would be just an integer like 0 for air, 1 for dirt, 2 for rock...

    But to be simple you can do 0-air and 1-dirt.

    The attached capx has almost every kind of terrain generation I could think of. At the very least it gives something to play with. Basically any sort of generation will be an equation and you then fiddle with the numbers to get different effects.

    Most of it isn't very complicated, not even the equations, although they can look busy. I'll break down one of them, the "dual sine":

    (2+rnd1)*sin((2.1+rnd2)*360*Array.CurX/40+33*rnd3)+(3+rnd4)*sin((1.5+rnd5)*360*Array.CurX/40)+15[/code:1bq00sn3]
    Basically this is two sine waves added together. The general form of a sine equation is:
    y = amplitude * sin(frequency * x + offset)
    When two or more sine equations (with different amplitude, frequency and/or offset ) are added together you get an interesting smooth curve.  All the numbers are pretty much arbitrary except for 15 which is centering it vertically in the array.  The only other values that are somewhat important are the ones that define the amplitude such as (2+rnd1) or (3+rnd4), which I picked to make sure the hills don't get too high or low.  As it is it has a vertical range of 14.
  • Slider -> set CSS style "transform" to "rotate(90deg)"

  • The tilemap has no angle so the most you can do is rotate the angle of the layer the tilemap is on.

  • Doing it with an array is just as easy. The only difference really is you're setting a value to the array instead of creating the object right away. You could do it in two passes but really it's basically the same as above.

    array for each xy

    --- array set at (array.curX, array.curY) to noisejs.perlin2(this.curx/this.width*noise_scaling, this.cury/this.height*noise_scaling) + lerp(-1, 1, this.cury/this.height)

    array for each xy

    --- array set at (array.curX, array.curY) to this.curValue>0

    With that it's just one material. For two you could do

    array for each xy

    --- array set at (array.curX, array.curY) to round(max(this.curValue*2))

  • Use your own hosting like Dropbox or something instead of the arcade.

  • You could use the distance() function or use the pythogerian theorem to find the hypotonuse.

    Hypotenuse = sqrt(x^2 + y^2)

  • Well I only know what I read about it and it isn't really something you learn in a school.

    Basically the plugin allows you to make perlin or simplex noise (look them up to see what they look like). The plugin uses a "seed" for the randomness so with the same seed noisejs.perlin2(0.5, 0.1) for instance will always give the same value, whereas c2's random() will give a different value every time.

    Now from what I've read and messing with the plugin this is some info about the expressions.

    noisejs.perlin2(x, y) returns a value from -1 to 1.

    The example capx translates that to a value from 0 to 100 for opacity. You could just as well set it to 100 or 0 by comparing if the value of noisejs.perlin2 is greater than 0. That would give blocks or no blocks instead of smooth noise.

    The parameters x and y should be non integers to give differing values. That is why the example divides loopindex("x") and y by 10 in the expression. I guess that can be thought of as a scaling factor. If you use just integers you'll get just 0 returned.

    Now that we've got some of the low level stuff out of the way the idea to create hills instead of just blobs is by combining perlin noise with something else. This link shows to combine the perlin noise with a vertical gradient to get the hills. After that the rest of the info loses me, probably because it's for some noise library.

    Ok to use that let's do what the example capx does and loop over all the squares. This can be done any way you want whether with an array or no. It makes little difference.

    width = 100
    height =100
    noise_scaling = 1
    
    for x from 0 to width-1
    for y from 0 to height-1
    ---- solid?[/code:isiwr3f9]
    
    So your perlin noise at every point would be:
    noisejs.perlin2(x/width, y/height)
    or with scaling noisejs.perlin2(x/width*noise_scaling, y/height*noise_scaling)
    
    We also only want block or no block instead of shades of blocks so we can just place a block if the perlin noise is greater than 0.  It would then look like this:
    
    [code:isiwr3f9]width = 100
    height =100
    noise_scaling = 1
    
    for x from 0 to width-1
    for y from 0 to height-1
    noisejs.perlin2(x/width*noise_scaling, y/height*noise_scaling) > 0
    --- create block[/code:isiwr3f9]
    
    So far so good but that just gives blobs everywhere.  A solution is to add a vertical gradient to it.
    This can do it: lerp(-1, 1, y/height). It will give -1 for the top 0 for the center and 1 for the bottom. So you expression is now
    noisejs.perlin2(x/width*noise_scaling, y/height*noise_scaling) + lerp(-1, 1, y/height)> 0
    Which will give more or less hills centered vertically.
    
    There's probably more you can do such as shift it up and down by adding a number but the general thing to do is fiddle with the numbers and experiment until you get something you like.
  • JamesXXXYZ

    Sorry I'm unable to fix it or merge features from your capx to mine. Pretty busy.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads