Qushy's Forum Posts

  • What did you put in the URL? If the file is included in the project, the URL should be simply "filename.jpg"

    Yeah that was the problem, I'm putting "filename.png" and it gives me the error I posted, you can find the URL that it's searching at in my first post. I'm getting the images straight from the server now tho, thank you very much! :D

  • Put this before your URL:

    https://cors-anywhere.herokuapp.com/

    Example:

    https://cors-anywhere.herokuapp.com/https://i5.walmartimages.ca/images/Enlarge/094/514/6000200094514.jpg

    Will this work for any URL cause for the pics in the project I get a 404 error.

    Thank you so much for the reply! :D

  • Hello, I'm trying to load an image that is in the project and I'm getting the following error in the console

    	Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://editor.construct.net/r204-2/preview/112_necklace.png. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
    

    If you see, it's the construct preview URL, the file "112_necklace.png" exists normally in the Files/Content folder. Am I missing something here?

  • Hello, I'm trying to the image point of the origin from a sprite and the result is always 200, 150. No matter where I put the origin.

    This is my code:

    imagePointsX = puzzle.x + piece.getImagePointX(i); imagePointsY = puzzle.y + piece.getImagePointY(i);

    Tagged:

  • Hello, I was wondering if I can set the animation frame of a sprite through code and if so how?

  • What the first action ("Go to URL") is for? You need to remove it. The rest looks ok to me.

    Thanx, the problem is that the queries return NaN. Can I define the browser URL so I can get the required data?

  • Hello,I have a rather simple question to ask. I would like to store the value of a URL parameter in an integer, how do I go on about doing that?Here's my current situation:

    Thank you in advance for any help. :D

  • Try asking in the scripting forum:

    https://www.construct.net/en/forum/construct-3/scripting-51

    Apparently I was "painting" with black lines oin the DrawingCanvas so for some reason all values were zero (even the drawn ones), I changed color and now it works fine. :D

  • Heeey thanks for the help! :D

    I almost got it working but for some reason the playerPixels varaiable is giving me an array of zeros even when I draw on the Drawing canvas so I can't compare between the two DrawingCanvases.

    Here's how I call the getImagePixelData() of the two DrawingCanvases:

    	function load(playerImage, computerImage)
    {
    	playerImage.getImagePixelData().then(playerData=>loadComputerData (playerData,computerImage));
    }
    
    function loadComputerData (playerData, computerImage) {
    
    	computerImage.getImagePixelData().then (computerData=>compare(playerData, computerData));
    }
    
    
  • You need to execute "DrawingCanvas Save snapshot" action, wait for it to complete, and then you can read pixels with expressions, for example:

    DrawingCanvas.SnapshotRedAt(10,20)

    DrawingCanvas.SnapshotGreenAt(10,20)

    DrawingCanvas.SnapshotBlueAt(10,20)

    DrawingCanvas.SnapshotAlphaAt(10,20)

    While this works just fine for a single pixel, when I try to access all pixels of the snapshot it takes some serious time. Is there any way to do it through code?

  • You need to execute "DrawingCanvas Save snapshot" action, wait for it to complete, and then you can read pixels with expressions, for example:

    DrawingCanvas.SnapshotRedAt(10,20)

    DrawingCanvas.SnapshotGreenAt(10,20)

    DrawingCanvas.SnapshotBlueAt(10,20)

    DrawingCanvas.SnapshotAlphaAt(10,20)

    Thank you so much for the answer! :D

    While this works just fine for a single pixel, when I try to access all pixels of the snapshot it takes some serious time. Is there any way to do it through code?

  • Hello, I have a DrawingCanvas instance which I use to let the player draw on it. I would like to manipulate the individual pixels of the DrawingCanvas instance through code. How do I access these pixels? getImagePixelData() seems to return something but I don't know how to access an individual pixel on it. In the documentation it says that it resolves an ImageData object but the data property doesn't exist when I try to access it. :/

    Thanks in advance for any help, this is really important to me. :D

  • Looks like there is a plugin here that will convert an image into a base64 string, where you can then run comparisons. See this thread for info and the link. https://www.construct.net/en/forum/construct-3/how-do-i-8/drawing-canvas-base64-string-141689

    Thank you so much for all the help! :D

    I am at the point where I've gotten the Canvas Snapshot but I don't know how to access the pixel information. I would like to compare the pixels, so if I find to access the pixels values I'm pretty much done. :D

  • Oh sorry I misunderstood what you were wanting. Are you doing a drawing game, where accuracy to the original is the goal?

    Yeah exactly, I want to get the drawn pixels on the right half of the Canvas Snapshot and compare them to the pixels on the left.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • https://www.construct.net/en/tutorials/saving-a-snapshot-381

    Thank you so much. :D

    However I would like to take the pixel data of the snapshot and manipulate them without saving them, if anyone knows of such a way please let me know. :D