dop2000's Forum Posts

  • [removed]

    EDIT: Never mind, found "LocalStorage Set/Get Binary" actions. I don't know how I never noticed them before!

  • It is possible with BinaryData plugin - you can convert the image to base64 string and save it to Local Storage. However, to restore it you will have to load the image into a sprite first, and then paste the sprite to DrawingCanvas. There may be some quality loss if window size has changed, for example. Also, if the image is large, base64 string may be really long (many megabytes)

  • You need to multiply by that expression, and add a small delay before "Save image" action - because pasting a large image may take a few ticks.

    The result in my case was an image with resolution 1081x1922. Which is pretty close, but I don't know how to make it exactly 1080x1920..

  • when you create an event you can add only once "On Key Pressed", every other condition or sub-event will give only the option "Key is down".

    These are two different kinds of events. "On" event is a trigger, it fires only once when the key is pressed. Only one trigger is allowed per event. "Is" event is a condition, if this key is down, the event will run every tick, until the key is released.

    So the easiest way to fire the event once all three keys are pressed is this:

    On D pressed
    Is DownArrow down
    Is RightArrow down
    

    But of course it doesn't take into account how fast the keys were pressed and in what order. You need to save the time when each key was pressed. The array seems like an overkill for me, you can do it with a pair of variables - pressedRight and pressedDown.

    On DownKey pressed
    Set pressedDown to time
    
    On RightKey pressed
    Set pressedRight to time
    
    On D pressed
    Is DownArrow down
    Is RightArrow down
    pressedDown > (time-0.5)
    pressedRight > pressedDown
    ....... Play combo animation
    

    This event will fire when all three keys were pressed within 0.5s and in this order: Down->Right->D

  • I was going to suggest the same as lionz, but use a global variable instead of an instance variable on the button. The button won't remember its variable when you return to Layout1, unless it's set as global (which I don't recommend here) or has Persist behavior.

    So a global variable would be the easiest choice.

  • Ashley Ah, will do, thanks. I posted here mostly to see if anyone else have the same issue.

  • If you can reliably reproduce it please file an issue.

    You mean with Chrome support? How do I describe the problem? "Focus doesn't always work in some 3rd party app I'm using" - I really doubt they will look into it.

  • I am using the latest Chrome version 94.0.4606.54, and I deactivated all extensions, it didn't help.

    I also tried several different Construct releases - from r234 to r263, they all have this problem.

  • I think you need to resize the DrawingCanvas object to 1080x1920, either multiplied or divided by DrawingCanvas.pixelScale

    Resize the sprite to the same size and paste it on the canvas. Then save the canvas image:

    DrawingCanvas Save Image
    System Wait for previous action to complete
    Browser invoke download of DrawingCanvas.SavedImageURL
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried using the keyboard object and "intercepting" the keyboard combination ALT+F4 ? (On Alt is down And F4 is down; trigger once while true)

    I can try this, but what's next? I will not be able to prevent the window from closing.

    oosyrag I'll try it, thanks!

  • oosyrag No, must be a different issue. And that flag they mention is no longer available.

    This only happens in event dialogs, I haven't noticed any other problems with focus in Chrome.

  • I will need it to work on Windows and possibly MacOS.

    Someone just answered me in this old post, but I wonder if there is an easier and less hacky solution.

  • This is awesome, thank you!

  • I need to prevent closing my game when users press Alt-F4. Instead, I want to and exit the game gracefully by showing a dialog like "Do you want to quit the game? Any unsaved progress will be lost. Yes/No"

    Is there any way to do this with NWJS export?

    Tagged: