citron2010's Forum Posts

  • What I do is:

    Every time a variable (including Booleans) is changed, I call a "save" function.

    This function writes ALL the variables I want to save to local storage (not just the one that just changed) to a dictionary ("Add key" action)

    For example, if I have a Boolean named "mute":

    Key = "mute"

    Value = mute

    This stores either a 0 or 1 in the dictionary against a label of "mute" (I use the same names for labels in the dictionary as the variable I'm storing there).

    After I've saved all the variables to the dictionary, I then save the dictionary to local storage.

    So, my dictionary is called "saved", so on the LocalStorage object, I use the Set Item action with:

    Key = "saveData"

    Value = "saved.AsJSON"

    So now there's a single key in local storage named "saveData" with a value of the JSON of my dictionary that contains ALL the values.

    To load them:

    On start of layout - LocalStorage - Check item "saveData" exists

    Then:

    LocalStorage - on item "saveData" exists:

    On the "saved" dictionary object, use "JSON - Load" with:

    JSON = LocalStorage.ItemValue

    Now the whole dictionary has been loaded back from local storage

    Then I can read through the dictionary for all the values loaded back into it and set the corresponding variables. For the "mute" Boolean above, the event would be Compare Values on the "saved" dictionary object where:

    Key = "mute"

    Comparison = "= Equal to"

    Value = 0

    And the action would be to set the mute variable to "False"

    Then add an Else that sets that variable to "True"

    For an integer or string variable, I just set the variable to the value of the corresponding key in the dictionary.

    Hope that make sense!

  • Add the video recorder object to your project then see the actions section here for how to stop/start recording:

    construct.net/en/make-games/manuals/construct-3/plugin-reference/video-recorder

  • Which keys are you using? I had some similar problem when using left and right shift. Switched to using left ctrl & right arrow and it was fine.

  • I'm wondering whether the "drag and drop" behaviour might be easier to implement than swiping? If you don't mind the character being in intermediate positions whilst it's being dragged, you should be able to snap it into one of your three positions when the player releases. Or maybe make the draggable sprite invisible and have your character snap to it once it crosses a boundary between positions?

  • Trig functions in construct take degrees instead of radians. To fix your formulas just replace 2pi with 360

    Works perfectly - thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    I want to nerf my AI by adding small random values to some of its parameters but I want the random values to be normally distributed (not uniformly) so more of the time the parameter is close to its nominal value and values further from the nominal value have a lower probability.

    I'm therefore trying to implement the Box-Muller Transform:

    https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform

    And this is a sample project:

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

    This project generates two uniform random numbers which it then uses to generate two normally distributed random numbers using the Box-Muller transformation. It then displays the four numbers on screen then plots them (after multiplying by 100 then adding 100).

    But the second Box-Muller number appears to be too low.

    Anyone know why I'm not getting the kind of distribution shown mid-way down this page:

    https://blog.cupcakephysics.com/computational%20physics/2015/05/10/the-box-muller-algorithm.html

    Bonus question - anyone know any alternative approach? Is there anything in the new "advanced random" object I could use?

    EDIT - cleaned the project up a bit

  • Layouts: 3

    Event sheets: 4

    Total number of events: 450

    Total number of conditions: 487

    Total number of actions: 1223

    Total lines of JavaScript code: 0

    Object types: 166

    Families: 23

    Project was worked on in C2 for maybe six months years ago then restart in C3 six months ago, so 12 months in total. Project is very close to completion.

  • Layouts: 3

    Event sheets: 4

    Total number of events: 450

    Total number of conditions: 487

    Total number of actions: 1223

    Total lines of JavaScript code: 0

    Object types: 166

    Families: 23

    I feel like an amateur!!!

  • I’d been thinking of posting my project’s stats and asking everyone to share theirs. My projects relatively small compared to yours - I’d guess around 10%. Yours seems huge - I’d love to know how others compare.

    Has the saving time slowly increased as you’ve worked on the project or has it recently jumped up?

  • Another pro for sprite fonts is consistency across platforms. I had some issues where text objects looked different on mobile and a post here somewhere suggested switching to sprite fonts which I did and it solved the problem.

  • You could also try making the rope out of individual pixels spaced apart but joined with distance joints. You can then adjust the frequency and damping of these joints - at extreme values, you can get all sorts of weird behavior, so you'll need to experiment. Unfortunately, distance joints are invisible - so what I've done is drawn between the pixels using a drawing canvas that I clear every tick.

  • Touch should be enough, but bear in mind Touch can do more than just a mouse can. You might have already seen this quote from the manual:

    Use mouse input

    If enabled, mouse clicks will simulate touch events. Clicking and dragging the left mouse button will simulate a touch along where mouse dragged, and single clicks will simulate taps. This can be very useful for testing touch events work properly on a desktop computer with no touch input supported. However, only single-touch input can be simulated with a mouse, and a mouse is much more precise than a touch, so it is still best to test on a real touchscreen device.

  • Start a timer then only allow the action if the timer's "is timer running" expression is false.

  • This is the order of events according to the manual:

    On performing a successful purchase:

    1. On purchase success
    2. On transaction finished
    3. On product owned

    So I believe the safest option is to give the IAP only "On product owned"