Grimmy's Forum Posts

  • Thanks fedca, yes this was my initial approach but sadly I dont think there is a way to make the advanced Random Seamless.

    Although Im still hoping there is :)

  • Well, after spending quite a bit of time with this I realised FastNoiseLite doesnt do 'seamless' noise ; which is really what Im after.

    So, does anyone know any library I can use to generate seamless noise in construct?

    I saw a few but tried them and they all have very weird setups that I just dont understand how to import and use in construct. I just get errors. For example, one begins like this...

    function Grad(x, y, z, t) {
     this.x = x; this.y = y; this.z = z; this.t = t;
     }
    
     Grad.prototype.dot2 = function(x, y) {
     return this.x*x + this.y*y;
     };
    

    ..which is neither a class of regular function, others have other, even weirder looking setups and I just get errors everytime I try to hook them up.

    I am well aware of using export and import but I cant get anything working.

    Does anyone have any recommendations?

    Thanks

  • Thanks. using...

    import FastNoiseLite from "./fastNoiseLite.js";
    

    ...instead of...

    import * as FastNoiseLite from "./fastNoiseLite.js";
    

    ..works a treat.

    Oddly though, if I put the import in the main script it doesn't work, but if I put it in the import for events sheet it does. Is there a reason for that?

    Thanks again

  • OKay. Here is the c3p file.

    Cheers

  • Hi, I am trying to use the FastNoiseLite noise libray but I keep getting the error: FastNoiseLite is not a constructor or FastNoiseLite is not defined.

    In my import for events script I have:

    import * as FastNoiseLite from "./fastNoiseLite.js";
    

    The fastNoiseLite.js script is in the script folder with the correct case name

    fastNoiseLite.js has purpose 'None Set'

    fastNoiseLite.js has export set eg..

    export default class FastNoiseLite { //...code
    

    And in my function triggered by a button press I create a new instance with :

    const noise = new FastNoiseLite();
    

    which is where the error happens.

    ..Any ideas?

    Thanks

  • Thanks! I got it working.

  • Does it matter that this javascript is in the event sheet and not a separate js file?

  • yes :) but I still get the error

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks but not much help I'm afraid. That demo seems to just getImagePixelData followed by loadImagePixelData.

    Also, that demo script very complicated and hard to understand. I just want to know how to plot a single pixel on a 1 by one canvas. If I cant manage that I stand no change of doing anything close to what that demo is doing.

  • I am trying the most basic approach to add a single red pixel to a 1 by 1 canvas.

    var drawingCanvasInst = runtime.objects.DrawingCanvas.getFirstInstance();
    // Define the pixel data (red)
    const imageData = [255, 0, 0, 255]; // Red pixel
    
    // Log the image data array for debugging
    console.log(imageData);
    
    // Load the image pixel data onto the canvas (1x1 pixel)
    drawingCanvasInst.loadImagePixelData(imageData);//ERRORS HERE
    

    The console data prints fine but then it errors at the loadImagePixelData command with TypeError: unexpected type. How can I resolve this?

  • Just to make things difficult it seems the coordinates for the bumpmapping effect used co-ordinates between 0 and 100 so it has to be normalized.

  • I've seen the example and I have my bumpmapping on a separate layer. I set the parameters x and y of the bumpmapping effect like so...

    (Spaceship.x/LayoutWidth)*100

    (Spaceship.y/LayoutHeight)*100

    This 'should' put the bump map at wherever my spaceship is, but instead the light is offset. The more I move to the right for example, the more the light move further to the right of my spaceship. The same in all directions. Its only ever correct in my starting position.

    It seems maybe there is some kind of light direction that's not definable maybe?

    Is there a way to position the light 'source' exactly where I want it?

    Maybe there is another alternative this?

    Cheers

    Tagged:

  • How can I stop autobrush painting land borders at the edge of my tilemap?

    Is there any way to change the behaviour of how the autobrush handles map edges?

    Thanks

  • Hi, Im looking into the advanced random plugin to generate maps and I was wondering if there is somehow a way to make the values seamless so that it can be used the make seamless noise textures.

    Thanks

  • ..without using javascript.

    Thanks

    Tagged: