citron2010's Forum Posts

  • I would use a drawing canvas. You can paste both the sprite and the 9patch on it, and then drag the canvas object.

    > -> DrawingCanvas: Paste object Sprite with effects
    -> DrawingCanvas: Paste object Mask with effects
    

    Or save the canvas image and then load it into another sprite.

    > -> System: Wait 0.1 seconds (use time scale: True)
    -> DrawingCanvas: Save image (PNG, quality 75, offset 0, 0 size 0 x 0)
    -> System: Wait for previous actions to complete
    -> AnotherSprite: Load image from DrawingCanvas.SavedImageURL
    

    That's exactly what I've done - but the problem is that the cropped corners are black not transparent.

  • Ultimately, I want a layer of thumbnail images that the user can drag around. Initially I cropped the corners of the thumbnails using a 9patch with its blend mode set to “destination atop” on a transparent layer with “force own texture” enabled.

    I then made the thumbnails draggable and set the 9patch to be a child, so it follows when the thumbnail is dragged.

    The problem with this is that when a thumbnail is dragged over another, their 9patches cut part of the other thumbnail out and it looks ugly.

    So, I figured the solution would be to crop the corners off BEFORE saving the thumbnails – but when I do that, the cropped corners are black not transparent.

    This sample project shows the issue. I have a sprite with its corners cropped by a 9patch, then paste the sprite into a drawing canvas, then paste the 9patch in, then copy the contents of the canvas to a second sprite and download it too.

    As you’ll notice, the corners are black. I set the background of the project to red to a) show the black corners more easily, and b) to try to see where the black is coming from.

    Any ideas?

    I have considered giving each thumbnail/9patch pair their own layer, but I could have up to 50 and felt this might cause performance issues as they’d all need to have “force own texture” enabled.

    https://drive.google.com/file/d/1JYEnTHC1_JdG9jiOjDpmFZc6gXGYMO_D/view?usp=sharing

  • I recently encountered this exact problem and agree it would be nice if 9-patches had animations/frames.

    I ended up swapping most of them out for either HTML buttons or text inputs where you have full control via CSS - might work for you too?

    EDIT - just realised that I also made some of my 9-patches plain white so you can easily set their colour.

  • It has a REST API so you can query that using Construct's AJAX plugin.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not 100% sure, but don't think you can change this - it's what the OS decides, but you can confirm support by evaluating the "Desktop features supported" expression

  • I've been using ChatGPT for a while - not to try getting it to code for me but to teach me how to do something. Also been using Gemini more recently.

  • affectThisThing->whenThisHappens->byDoingThisThing. I don't really understand, but I think I do a little bit. Thank you.

    You just need to remember that, if an event has no conditions or triggers, it will run every tick - it's the "tick" that effectively triggers the event

  • "On any touch" only triggers when you start the touch

    Then Func_Squish is only called if Touch Is touching Fam_spr

    So the code in the function only runs once per touch

    "Every tick" does nothing - you can just delete it

    Your squishFactor will still be randomised every time the function is called

    Note that you NEVER actually need "Every tick"! If the trigger/condition column is empty, the actions will always run every tick.

    Events can either be "Conditions" which are checked every tick or "Triggers" which only fire when something happens.

    More details here:

    construct.net/en/make-games/manuals/construct-3/project-primitives/events/how-events-work

  • There's a few things:

    For some reason that I don't understand, "Touch - Is touching Fam_spr" picks all the spr's rather than just the one that being touched.

    To solve that, replace Fam_spr with spr

    But that still doesn't work because the function resets the picking list and will pick all spr's again. To solve that, edit the function and enable "copy picked" - this will copy the list of spr's picked in the event that calls the function and pass it to the function.

    Also, you don't need "Every tick" in that function.

  • I had a brief discussion with ChatGPT about this a while ago and came to the conclusion that it would be more effort to implement than I was willing to put it.

    It suggested three approaches:

    1. Perceptual hashing
    2. Convoluted neural network (Compute a single vector for each image using a small CNN/ViT, then compare with cosine similarity.)
    3. LPIPS (Learned Perceptual Image Patch Similarity)

    Make of that what you will!

  • If you look in the inspector, you'll notice that FLYINGENEMY's timer never gets above zero - that's because you're triggering every tick if there's no line of sight so it just keeps resetting. An easy way to fix is by adding a "Trigger once while true" condition to the NOT LOS condition.

  • Seems to be working in this test project:

    drive.google.com/file/d/1xauxzshCpUKnAOHDBouIMEqpDhkr5R-D/view

  • There’s the “Is portrait/landscape” condition in the browser plugin. You’d just need to check it every tick.

  • I've just finished a prototype for a project that does similar so thought I'd put all my recently acquired knowledge to work and make this sample project:

    drive.google.com/file/d/1yFU4VRNWxOfEVbSs5vkE3vu-0ImHsLY7/view

    Essentially, it checks local storage for a picture and if it exists, loads it into a sprite then resizes/repositions it. If you click the picture it opens a file chooser to select a picture - in which case it loads it into the sprite and also saves it. The one gotcha is that to save a picture to local storage requires that the picture be in a binary data object which you can't populate directly from the file chooser. Instead you make an AJAX request to the file chooser to populate the binary object - then you can write it to local storage.

    My project's a little more complex and also involves saving pictures to and loading from a remote server, saving them to local storage for off-line use, caching previous/next pictures in memory to speed up loading when a user switches between pictures plus cropping of photos uploaded via the file chooser before sending them to the remote server for storage - so feel free to pick my brains if you need anything more!