dop2000's Forum Posts

  • even if it distorts the game slightly.

    I don't think it's a good idea. What if someone runs your game on an ultrawide monitor?

    To scale preserving the aspect ratio - use "Scale Outer" and enable "Unbounded scrolling" on the layout. No code needed!

    Here is a demo:

    dropbox.com/scl/fi/nlcnbsjne5ae9p90lixzf/ScaleOuterDemo2.c3p

  • Scale outer cuts the image, parts of the display are not shown in many situations

    It doesn't cut anything, you are probably not using it right.

    Can you post an image of what you are trying to make, or a demo project?

    Perhaps what you are looking for is the "System Set Canvas Size" action? It has the same effect as changing the viewport size in project properties.

  • Can you post your project file, or at least some screenshots of your code?

    Make sure the new position of the character is within the layout bounds - make the layout bigger if needed. Some behaviors (like Pathfindind) won't work if the object is outside of the layout.

  • I have no idea what your code does. I asked ChatGPT and it said "The code breaks Construct's input system by stretching the canvas with CSS instead of resizing the internal render size."

    Why don't you use the built-in "Fullscreen mode" setting? The most popular option is "Scale outer", it properly fills the entire viewport.

    construct.net/en/tutorials/supporting-multiple-screen-17

  • Your timescale is 0, that's why the Flash behavior is paused.

    You have a condition "if layer 4 is visible -> set timescale to 0", make sure you reset the timescale back to 1.

    I suggest using layer names instead of numbers, this way if you remove or add any layers, you won't have to change their numbering in your events.

  • Your link shows "Access denied".

    You can run your game in Debug Mode (Shift+F4) and check yourself what happens with the sprite.

  • From what I've learnt the picking algorithms vary depening what you do in you function and if you use "for each" loops.

    I don't think that's true. As I wrote in my previous comment - picking the array instance should be the first condition!

    Pick, then loop through the array. It doesn't matter if you use "for each X" or a system "for" loop. And you don't need to pick the array again inside the loop.

  • You need to provide some details and/or share your project file.

  • The entry condition for the loop are "for each X element" and "ArrayName" = passed name argument from function

    ArrayName check should be the first condition!

    Did you set the ArrayName value correctly for each array? You can check this in the Debug Mode.

    Since every array object has only one instance, you don't really need the instance variable. You can just pick by array UID:

  • What?? That's incorrect. You need to delete records in a loop, in reverse order.

    For "n" from array.width-1 to 0
    Array.at(loopindex)=""
     ----> Array delete index loopindex from X axis
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can open the project in the LTS version - it will support SDK1 addons for another year.

    construct.net/en/make-games/releases/lts/r449-3

  • Also will this trigger once?

    + TextTime: Text is "00:00:00" (Ignore case)

    No, if someone runs your app on a 240 Hz monitor, this event will trigger 240 times per second and send 240 requests to the server.

    Also, comparing the time to "00:00:00" to detect the start of a new day is a bad idea, because the app might not be active at that exact second. Instead, save the current day in a variable and compare it every few seconds. If the day has changed - update the variable and send a new request to the server.

    As for comparing the time to sunrise - the server returns it in "HH:MM" format, you can use tokenat to extract the hours and minutes from the string.

    Local string sunriseTime‎ = 07:25
    Local string currentTime‎ = 04:07
    Local number minutesToSunrise‎ = 0
    
    -----> System: Set minutesToSunrise to (int(tokenat(sunriseTime, 0, ":"))-int(tokenat(currentTime, 0, ":")))×60 + (int(tokenat(sunriseTime, 1, ":"))-int(tokenat(currentTime, 1, ":"))) 
    
    --------+ If minutesToSunrise ≥ 0
    ---------> Text: Set text to int(minutesToSunrise÷60) & " hours " & zeropad(minutesToSunrise%60, 2) & " minutes to sunrise"
    
    --------+ Else
    ---------> Text: Set text to "Past the sunrise time"
    

    You can copy/paste this into your event sheet:

    {"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[],"actions":[],"children":[{"eventType":"variable","name":"sunriseTime","type":"string","initialValue":"07:25","comment":"","isStatic":false,"isConstant":false},{"eventType":"variable","name":"currentTime","type":"string","initialValue":"04:07","comment":"","isStatic":false,"isConstant":false},{"eventType":"variable","name":"minutesToSunrise","type":"number","initialValue":"0","comment":"","isStatic":false,"isConstant":false},{"eventType":"block","conditions":[],"actions":[{"id":"set-eventvar-value","objectClass":"System","parameters":{"variable":"minutesToSunrise","value":"(int(tokenat(sunriseTime, 0, \":\"))-int(tokenat(currentTime, 0, \":\")))*60 +\r\n(int(tokenat(sunriseTime, 1, \":\"))-int(tokenat(currentTime, 1, \":\")))\r\n"}}],"children":[{"eventType":"block","conditions":[{"id":"compare-eventvar","objectClass":"System","parameters":{"variable":"minutesToSunrise","comparison":5,"value":"0"}}],"actions":[{"id":"set-text","objectClass":"Text","parameters":{"text":"int(minutesToSunrise/60) & \" hours \" & zeropad(minutesToSunrise%60, 2) & \" minutes to sunrise\""}}]},{"eventType":"block","conditions":[{"id":"else","objectClass":"System"}],"actions":[{"id":"set-text","objectClass":"Text","parameters":{"text":"\"Past the sunrise time\""}}]}]}]}]}
    
  • You need to pick the right enemy instance, which is pinned to the collision box.

    The easiest solution is to add both objects to the same container. They will be logically connected and will be picked automatically.

    construct.net/en/make-games/manuals/construct-3/project-primitives/objects/containers

    You should also use the hierarchy feature instead of the Pin behavior. Then you will be able to use "Pick child/parent" conditions to easily pick objects in the hierarchy. For example:

    Bullet on collision with EnemyCollisionBox
    EnemyCollisionBox pick parent Enemy : Enemy subtract 1 from health
    
  • I need them to all hold individual variables and dictionary info per item, so I'd have no idea how to do that with individual frames.

    You should store all that info in one or several arrays/jsons. It's MUCH easier than manually enter it into instance variables. That's what we do in our game - the array holds about 300 cards:

    Also sorry, was that you saying how to do it? I'd understand a lot easier with the event sheet, I'm more of a visual learner.

    Which option? Creating from the list of objects, or using scripting?