R0J0hound's Forum Posts

  • 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.

  • The installer option does nothing, that's why it's not showing up.

  • line x<220

    --- destroy line

    every 3 seconds

    pick topmost line

    --- create line at """end of line"""

    --- line set angle to choose(-90,0,90)

    Where the origin of the line is the left-center and """end of line""" is an image point at right center.

  • Ribis

    You can make the graphics any way you want there's no right way.

    JamesXXXYZ

    That code just defines 3 isometric direction vectors, not rotation.

    Angles can be handled exactly as I stated before.

  • JamesXXXYZ

    I'm not sure what you mean by isometric angles not being linear. If 0 degrees is to the right and 90 degrees is down then with 1:2 isometric the vertical speed should half the speed of going horizontal. sin and cos aren't a reason for why it wouldn't work.

    Would it be simpler if you just did all the motion as if in top view and convert to iso by dividing all y positions by two?

  • indiegrimes that is what I meant. You can select point sampling in the project settings to eliminate the blurring.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The browser object has a execute js action.

  • 100*random(1, 1.1) ?

  • So the 8 direction capx doesn't work right for isometric. I can see that, which isn't a problem since it wasn't made with isometric in mind.

    So the problem becomes how to find the closest angle as in your image. There probably can be an elegant formula to do it nicely, but barring deriving that you can check against all those angles to see if it's close.

    But wouldn't it be simpler to do all the motions from a top view and set all the visible stuff to an isometric projection? Then the 8 direction capx is perfectly applicable. I doesn't matter that 45 is an animation drawn at 22.5 degrees, because when the angle of motion is changed from to view to iso it will be 22.5.

  • indiegrimes

    You can already. There's a set resolution action to change it. The default resolution is the same as the canvas' size.

  • crugh

    You can paste (or draw) objects to the paster object with the paste action and then retrieve that image with the paster.imageUrl expression.

    Alternatively you could use the Canvas object which has similar behavior except it has a "paste layer" action that will assist.

  • JamesXXXYZ

    It does. Since it's using x and z it's rotating around the z axis. Use x and z for y axis rotation, and y and z for x axis rotation.

    You can convert an angle to the closest 8 direction with

    You can convert an angle to an iso projected angle with

    angle(0, 0, cos(a), sin(a)/2) where a is an angle.