Grimmy's Forum Posts

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

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ..without using javascript.

    Thanks

    Tagged:

  • I have created a tilemap whcih is seamless but I want this to repeat when the players nears the edge.

    How can I clone the existing tilemap with all the same tiles etc for this purpose?

    Obviously I can create a new instance of the tilemap, but this new instance will not have the tile data.

    I can see that its probably possibly using TilesJSON but Im not sure how Im supposed to store the Tilemap JSON data exactly.

    Thanks

    Tagged:

  • I think the way to do this is to copy TWO strips of tiles top to bottom and left to right and then fill the centre. I will let you know how it goes..

  • Thanks, but I honestly dont understand what you are saying. Anyway my idea is that I do the following:

    • I make a tile map and autobrush the top and left few rows/columns
    • I copy the left most column tiles to the right side and the top row to the bottom.
    • At this point I have a seamless tilemap but with an empty center.

    When I try to auto brush the center tiles, the auto brush simply overwrites the border tiles even though I am not performing an any action on these tiles. Is the a way for the autobrush NOT to change tiles that already exist?