AnD4D's Forum Posts

  • Since you mentioned rotation, here is an example of one way to do it that handles either oval being rotated. And as mentioned in the previous post it is completely independent of view scale, scrolling or rotation. The math is done across three actions to be more readable since combining it into one formula isn't very pretty. The trig functions are just used to rotate the xy position.

    https://www.dropbox.com/scl/fi/f30qzkjny5nl2fed85udn/map_map_to_layout.capx?rlkey=jz3bnfrrrfxqca247o12ibprp&st=bffq95ky

    Wow! This is impressive! It works with scale and scrolling. That is remarkable. Thank you!

    I'm going to have to spend some time studying this. Love it!

  • This is an example and it would be more convenient for me to do it through variables than to directly insert the parameters of objects into the formula.

    You didn't say anything about the scrolling, you only talked about the scale.

    Don't get me wrong, I appreciate the help, but what I essentially said was "How do I get this current version of my program to work with scale."

    It's like if I was making a platformer, and asked "How do I make him jump?" and you add in the jump, but remove the ability to walk.

    Again, as I said, I appreciate the attempt, but I'd have thought it's implied that I didn't want the other features of the program removed.

    Not to worry, thanks again for the help :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try this:

    -> OffScreenMouse: Set position to (lerp(SmallScreen2.BBoxRight, SmallScreen2.BBoxLeft, unlerp(SmallScreen.BBoxTop, SmallScreen.BBoxBottom, LayerToLayerY(OnscreenMouse.LayerName, SmallScreen.LayerName, OnscreenMouse.X, OnscreenMouse.Y))), lerp(SmallScreen2.BBoxTop, SmallScreen2.BBoxBottom, unlerp(SmallScreen.BBoxLeft, SmallScreen.BBoxRight, LayerToLayerX(OnscreenMouse.LayerName, SmallScreen.LayerName, OnscreenMouse.X, OnscreenMouse.Y))))

    > {"is-c3-clipboard-data":true,"type":"actions","items":[{"id":"set-position","objectClass":"OffScreenMouse","parameters":{"x":"lerp(SmallScreen2.BBoxRight, SmallScreen2.BBoxLeft, unlerp(SmallScreen.BBoxTop, SmallScreen.BBoxBottom, LayerToLayerY(OnscreenMouse.LayerName, SmallScreen.LayerName, OnscreenMouse.X, OnscreenMouse.Y)))","y":"lerp(SmallScreen2.BBoxTop, SmallScreen2.BBoxBottom, unlerp(SmallScreen.BBoxLeft, SmallScreen.BBoxRight, LayerToLayerX(OnscreenMouse.LayerName, SmallScreen.LayerName, OnscreenMouse.X, OnscreenMouse.Y)))"}}]}
    

    This works perfectly, no matter the scale and the scroll. Impressive.

    I don't understand how the magic is working, because I don't understand lerp and unlerp, but it does work no matter what I throw at it. Tempted to add rotation to it to see if it continues to work :D

    I wonder if this is the simplest way to do it. Rojo's words seem to suggest I've overcomplicated things. I try to avoid using variables, and this seems smart, but I'm going to have to sit down and tinker with it to better understand it.

    Thank you.

    Edit - Rotation does indeed break it XD But that wasn't what I was trying to learn, so it's still perfect.

  • I don't know why your map has a different shape than the surface and I don't understand why the actions on the map are inverted along the coordinate axes. Perhaps something happened to your hero in the story.

    I tried to make a simple example.

    https://fex.net/s/73anrpo

    Lol, yeah, our hero has problems XD

    This worked well for scale, but I note you added in a lot of variables and disabled the scrolling aspect of my code. The moment I put that back in, your version stopped working :(

  • So the black oval is like a scaled version of the screen rotated 90 degrees, and you want the mouse over that to translate to a position over the view?

    Let’s try and simplify it a bit first. If you make the oval not rotated and move the origin to the center then the calculated xy position on the view would be:

    (Mouse.x(1)-oval.x)/oval.width*viewportWidth(0)+scrollx

    (Mouse.y(1)-oval.y)/oval.height*viewportHeight(0)+scrolly

    Note: mouse.x(1) is the mouse position on the hud layer.

    Now let’s make it work if the oval is rotated 270 degrees like you have. Basically (x,y) rotated -90 will become (y,-x), but you have it vertically flipped (y,x). So swapping things around a bit the xy formulas will be:

    (Mouse.y(1)-oval.y)/oval.width *viewportWidth(0)+scrollx

    (Mouse.x(1)-oval.x)/oval.height *viewportHeight(0)+scrolly

    I'm afraid I struggled to follow this. I ended up with:

    {
     "is-c3-clipboard-data": true,
     "type": "events",
     "items": [
     {
     "eventType": "block",
     "conditions": [
     {
     "id": "every-tick",
     "objectClass": "System"
     }
     ],
     "actions": [
     {
     "id": "set-position",
     "objectClass": "OffscreenMouse",
     "parameters": {
     "x": "((OnscreenMouse.Y - SmallScreen.Y) / SmallScreen.Width) * ViewportWidth(0) + ScrollX",
     "y": "((OnscreenMouse.X - SmallScreen.X) / SmallScreen.Height) * ViewportHeight(0) + ScrollY"
     }
     }
     ]
     }
     ]
    }
    

    which didn't work. I'm assuming I did something obvious wrong.

  • I want to be able to interact with my world while using a mini-map.

    I've attached an example showing what I'm aiming for. It all works fine at 1x scale, but the moment I try something else, everything breaks.

    Can anyone have a look at this code and let me know what I'm doing wrong?

    https://1drv.ms/u/c/45d17dca4e466456/EW2nb7BZfLZAleIZ3m_iZo4B6Tze1yNAjJ7SFCeAFNLrUQ?e=qFLbR1

  • The Linux exporter will never say that it requires the Microsoft Edge WebView2 runtime. If you see that it means you tried to run a Windows WebView2 export on the Steam Deck.

    Don't know what to tell you. I uploaded a Windows version and a Linux version. My Steamdeck must have automatically tried to play the Windows version for whatever reason. I didn't specifically pick one at all.

    I just hit that green play button.

  • Check out this Ashley's comment:

    https://www.construct.net/en/forum/construct-3/general-discussion-7/games-nwjs-183964#forumPost1114476

    He's talking about Local Storage, but I imagine system saves work the same way.

    You can save the full state of the game to a file.

    In that case, I'll need to stick with NW.js for this release. Do you happen to know if the Steamworks plugin as compatible with NW.js?

    Edit - It does not support NW.js

    For crying out loud... Well, changing all those achievements over was a waste of time...

  • > "This app requires the Microsoft Edge WebView2 runtime. It will be downloaded and installed for you now."

    Use the Linux exporter for the Steam Deck. Don't use the Windows WebView2 exporter - despite the Windows compatibility on Steam Deck, it's not good enough to run WebView2, but the Linux exporter runs natively. See Exporting to Linux and the Steam Deck.

    I used the Linux exporter. I fixed it by making sure Steam automatically chose the compatibility, rather than forcing the latest (which felt like an odd solution).

  • Exported game using NW.js on steam, and my saves were fine.

    Upgraded to Steamworks, and exported using Windows exporter and saves are gone.

    Why are they different? How do I fix this?

  • Just tried the new exporter out on my Steam Deck, and I get this message:

    "This app requires the Microsoft Edge WebView2 runtime. It will be downloaded and installed for you now."

    It then downloads something for a long time... and then fails.

    This looks incredibly unprofessional. Why does it need to download an external program to work???

    Installer error 0x80000003

  • Turns out the new exporter is really good and does it all for you... BUT... it doesn't appear to be compatible with your old saves if you use the older NW.js method.

    I checked my Steam version, that I had a save. Uploaded the new version as a beta, and loaded that... saves immediately gone.

    Woo!!! Progress!!!

  • I used to use NW.js, but see that it's now being deprecated.

    I can see how to export to Windows and Linux, which I assume I'll need to do, but I don't see where I export for Steam. I have the Steamworks plugin, and have set the game up with achievements, etc, converting from Greenworks... but I have no idea what I'm meant to be doing.

    Tried using the search function on this site, but it's a mess, highlighting info from 14 years ago, and Google doesn't appear to be useful either.

    I used to be able to export for Win/Mac and Lin all at the same time. That convenience gone now?

  • I'm trying to load an old game I worked on, but it won't load. It says it's looking for the effect called "Lens". Problem is, the official Lens addon has been renamed Lens2... which is super useful.

    So now Construct 3 refuses to load the whole game because the plugin is missing.

    So I tried going back to an older version of Construct 3 so I could use it, but the second I try to load up the older version, I get an error message.

    Anyone else getting an error trying to load these:

    https://editor.construct.net/r251-2/

    https://editor.construct.net/r368-2/

  • Anyone else notice the latest stable build is a little laggy?

    I have been working on a game, and occasionally it lags at random points. Just a minor stutter here and there. The thing is, it's not that complicated a process that's showing a lag. Typically it's when sprites move using tween.

    I've been trying to figure out what the problem may be, but haven't had any luck.

    In any case, while working on this one, I updated some text for a game I've published on Steam, and republished it... and suddenly I'm seeing the same lag happening. Just minor stutters here and there, and there hasn't been any for years.

    The only difference is the latest build.