Grimmy's Recent Forum Activity

  • 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

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

Grimmy's avatar

Grimmy

Member since 20 Nov, 2012

Twitter
Grimmy has 2 followers

Trophy Case

  • 12-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

17/44
How to earn trophies