Grimmy's Forum Posts

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

  • Try Construct 3

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

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

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

  • Lets say my map gets created procedurally using advanced random and setting the tiles with the tilemap brush (eg set tile with brush) meaning that everything within the map area looks nice and connected.

    However at the edges of the map area (lets say it 512 by 512 tiles for arguments sake) I want them to loop seamlessly with the opposite side so I can effectively infinitely loop around the map if my character continues to move in any direction.

    How would I do this part?

    Tagged:

  • I have my css file already loaded up but I want to replace some old class name with a new name. Is that possible?

    Maybe something like this but I dont know how to access the css text itself..

    innerHTML.replace(".someClass",".newClass")
    

    ;

    Cheers

    Tagged:

  • Im actually using an external tool to visually create the css and html. Its perfect for complex html interfaces all but for this little issue that it uses a body tag.

    In an attempt to fix the issue Im trying to automatically rename the tag in C3 at runtime. I can do this fine for the html using the 'set html content' action but there doesn't seem to be a way to edit the .css file via script.

    Is there some javascript that can replace the css class 'body' with a class 'div'?

    Cheers

  • On export my html reads:

    <body class="body-1">
    

    and the style is...

    body.body-1 {
     position: static;
     display: block;
    ..etc
    }
    

    But if I change these to the following it works fine.

    <div class="body-1">
    

    and the style to:

    div.body-1 {
     position: static;
     display: block;
    ..etc
    }
    

    Can anyone explain why and is there a better way to get around this rather than having to change the body tags to div tags every time I export? Thanks