SoupOrWorm's Forum Posts

  • Start a knockback cooldown timer inside your function. Add a condition to the function itself to not run if the timer is running. The timer duration can be as low as a single frame.

    Thanks for the response, and sorry for the late reply. I'm assuming you mean using a cooldown variable and lowering it every tick if it's over 0 and raising it in the function actions. If so, I already tried that too.

    I think that these solutions involving checking veriables in conditions and editing them in actions aren't working because the function is being called multiple times at the exact same time, so there isn't really an order of the calls to stop every call after the first because there is no first. But that's just my hunch, I still don't really know what the issue is exactly or how to fix it.

  • One approach might be to store the tickcount expression in a global/static variable. When the knockback function is called, if the current tickcount is greater than the stored tickcount, apply knockback and update the stored tickcount. If the function is called and the stored tickcount equals the current tickcount, then you can ignore it as it was already called this frame.

    Thank you for responding, but that didn't seem to work for me. The function is still called multiple times on the same frame. Did I implement it wrong, or is there another way I should do this?

    I also tried ROJOhound's solution but it didn't appear to change anything either.

  • For context, I am making a metroidvania-style game and the specific issue is with my Knockback function that triggers when the player slashes at an enemy or interactable object. If there are multiple enemies or objects that the slash sprite collides with on the same frame, the knockback function is called a bunch of times and launches you into orbit.

    Most solutions to this seem to involve adding an additional condition to calling the function, but I call the Knockback funtion all over the place so it would take a really long to edit every single call. I'm trying to find a solution that only involves editing the function itself if possible.

    Thanks for reading, and please let me know if you have any ideas.

  • You do not have permission to view this post

  • The Steamworks addon should actually be easier to use - you don't need a steam_appid.txt file and it includes all its dependencies so it should more or less just work after an export without extra configuration steps. The documentation is here so maybe double check that. If you are still doing extra configuration steps you used to do for Greenworks, make sure you stop doing them for Steamworks, as it might actually break it.

    Thanks for the reply. I actually forgot to do that when I was testing the new plugin, so I don't think that's the issue... I'll keep tinkering a bit and update this if I find the issue.

  • The Greenworks plugin worked perfectly for me, but now that I am transitioning my project to using Steamworks and non-NWjs export options it doesn't seem to be doing anything when I test my project in Steam. Do I need a specific version of the Steam SDK? Could I be missing something else?

  • See the "Text editor" example above. "Read" action is asynchronous, you need to wait for "On file operation complete" trigger.

    I think I figured it out, thanks again for the help!

  • You need the FileSystem plugin:

    https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/filesystem

    https://editor.construct.net/#open=file-system-text-editor

    Thanks, it works for saving, but I'm not sure how to check if the file exists or if the loading works.

    This is what I did for saving and loading:

  • A while ago I made a system to store the user's options for my game using dictionaries saved to files using NWjs. The only issue is that I am moving away from exporting as NWjs and instead just using the dedicated Windows, Mac, and Linux options, so it doesn't work anymore. How can I tweak the system so that it still works?

    For clarity, this is an example of saving to the current system:

    Tagged:

  • This should work:

    > For each Button
    ..Mouse cursor over Button : Set scale to 1.1
    ..Else : Set scale to 1
    

    It works, thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've been trying to simplify and optimise my old code, and one way that I did this was to make a "buttons" sprite family and making one event in a universal event sheet that sets "buttons" scale to 1.1 if the cursor is over it, and sets its scale to normal if it isn't, just for a bit of polish.

    The problem is that if you quickly move your mouse from one button to another, both will stay at scale 1.1 until you stop hovering over either. How do I prevent this without manually copying the code for every single button sprite?

  • Main issue I'm seeing is you're not reading the pixel from the right spot. The snapshot size won't be the same size as the drawingCanvas unless the window isn't resized or if the drawing canvas' resolution mode is set to fixed, and the resolution is the same size as the canvas.

    Anyways, a fix would be to convert the coordinates. Instead of

    x = Mouse.x
    y = mouse.y

    use:

    x = Mouse.X*DrawingCanvas.SnapshotWidth/DrawingCanvas.Width
    y = Mouse.Y*DrawingCanvas.SnapshotHeight/DrawingCanvas.Height

    or if the drawing canvas isn't positioned at the top left of the layout:

    x = (Mouse.X-DrawingCanvas.BBoxLeft)*DrawingCanvas.SnapshotWidth/DrawingCanvas.Width
    y = (Mouse.Y-DrawingCanvas.BboxTop)*DrawingCanvas.SnapshotHeight/DrawingCanvas.Height

    https://www.dropbox.com/scl/fi/c9zekz1ru5pzw6u26mxon/read_pixels.c3p?rlkey=haodeqfz3vknri1qz8db4c5bm&st=b0zkb50o

    EDIT:

    Looks like these three expressions are approximately the same. So you could just divide the mouse position by the pixelScale. The fact that all three aren't all the same is another c3 issue but shouldn't matter too much.

    DrawingCanvas.SnapshotWidth/DrawingCanvas.Width

    DrawingCanvas.SnapshotHieght/DrawingCanvas.Height

    1/DrawingCanvas.PixelScale

    Edit2:

    If you manually set the fixed resolution mode size, then don't use pixelScale.

    Works like a charm, thanks!

  • I know that this may sound trivial but I've been trying everything and it will not work for some reason. My goal is to make it so clicking on a mostly blue tile sets the text to "Allied nation" and clicking on a mostly red tile sets it to "Enemy nation."

    I think that a solution to this woudl require someone to look at the code themselves, so here is a link: https://drive.google.com/file/d/1sXZBJ0OCJQ11ka5YeNRmlA601PMR1xI0/view?usp=sharing

    It's only a prototype so there isn't much to look through.

    Tagged:

  • When RedUnit collides with another RedUnit, both of them become isPaused. So event 16 processes two instances of them. And because the engine is so smart, it compares each Marker UnitID with a different RedUnit instance, alternating between them (I assume). As a result, some of the markers remain unpicked.

    Add "For each RedUnit" to event #16. You might need to do the same in some other similar events.

    It works! I am absolutely buying you another coffee for this.

  • I don't know if this will help, but in #16 you might need to move "Set isPaused to false" to the top of the event. Otherwise the whole event will execute several times before it stops. Avoid using "wait" actions in events that run on every tick!

    If that doesn't help, could you share your project file? It's difficult to understand what's going on by screenshots.

    Here you go: https://drive.google.com/file/d/1Q8747Y-_vmOHinae9tWqPQpAQcP9JmVe/view?usp=sharing