deadbus's Recent Forum Activity

  • the way you are trying to load the values from local storage is not going to work.

    But why? Let's image I have lots of variables in local storage. How to load them correct?

    Also, you should not save each value in the array separately - you should save the whole array

    Thank you, I'll try.

  • I have a problem accessing array after loading from local storage.

    I have an array with (81, 1, 1) size.

    I have different events using this array without any problems. Like events in this example. Let’s call it “example_1”.

    Then I decided to make save game option. For this I write and read (save and load) this array’s values in local storage.

    I’ve checked array after using this save/load functions and it’s filled absolutely correctly.

    However after using load function events in “example_1” stopped working.

    Looks like this event says array doesn’t contain value. I’ve checked many times, same array with same values – this event (and many similar) works before saving/loading and then doesn’t work after.

    I’ve changed this events so they now looks like this:

    I think I solved this problem only partly. My project contains lot of code and uses arrays a lot. So I fear somewhere somehow I won't fix this and problems will happen. And this bugs are difficult to find and identify.

    I've tried different Construct 2 versions and problem happens in all of them. Did any of you have this bug? Could you explain nature of it so I could fix it? Or maybe you know the way how to deal with it.

  • I think I know the answer:

    Once you use a "wait" action, even if you used "wait 1 second", the function parameters will not be stored, so you will end up with "0" if you put "function.param(0)" after the wait action.

    This is fixed in C3 I believe, where "wait" actions will still remember the parameters.

    But yes, storing the value elsewhere like you said, is a fair workaround.

    Thank you for your answer!

  • I think you're looking for the "on animation finished" trigger. It can be found in the animation conditions section of your object

    But I use it already. I send signal "on animation finished" trigger.

    I'm looking for a way to control when animation is finished so I can start other actions. The only way I found is signals. And my question was "is there another way to handle it?".

  • I'm making a simple game.

    I create balls on field. Creation has its own animation. After that there is check if balls of same color are near they are destoyed. Destruction has it's own animation.

    Right now I do a signal when creation animation is over. Destruction actions wait for that signal to start own animations.

    But with lot of following one after another events and animations it's difficult to control everything with signals.

    Especially I can't find solution for a situation when I need to start actions but they shouldn't start if there is any animations. And using signals is not an option because if animation didn't start then it won't produce any signal. And actions will be waiting forever for that signal.

    Is there any other and hopefully more optimal way to handle such things with animations?

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I call function and give it an input parameter. Inside that function I call another function and give it same parameter. Somehow after completing second function input parameter changes to 0.

    I've added varible 'xxx' for debugging. In this situation everything is perfect and 'xxx' with every function call takes input parameter value. If I place 'xxx' after function call but before signal then it will work same way.

    Signal comes from second function. It contols if it's completed (checks values of inside variables). If I place 'xxx' after signal then on first function call 'xxx' won't get input parameter's value. On second and all next function's calls 'xxx' will be 0.

    I can solve problem easily by making global variable containing input value, but I want to understand logic behind described situation.

    Tagged:

  • it is not really the function, it is the fact that the objects created do not become "pickable" until the next top level event. You could move the actions from the function into the "On start of layout" event and they would still not work.

    This explains my problem. Does it happen only with creation of an objects?

    I've added signals for finishing creation and added "Wait for signal" between actions. Now it works.

    Also I've tried your merhod with another "On start of layout event" and it works too.

  • Objects do not finish the creation process until the top level event that creates them finishes. So, You can not call a function in that event - as far as the function is concerned, the objects do not exist yet.

    the easiest solution may be to add another "On start of layout" event immediately after the current one, and call the function from there.

    So problem happens because of using function? Event starts function but doesn't wait finishing actions inside this function, right?

  • Most important thing for me is to know how to set up loops in "On start of layout event". Should I control when loops finished and only then start following actions or not?

  • I have a function that creates 80 objects using loop "for each". Then I call this function in "On start of layout" event.

    Next actions in this event do some stuff with created objects (makes them visible, creates another objects over them etc). But I found those next actions doesn't work like objects don't exist yet.

    If I understand it right event starts creation loop action and start following actions without waiting for loop to be finished. Is it true?

    Tagged:

  • You could try:

    On collision bullet set angle of motion to angle of motion + random(-10,10)

    That is what I'm doing right now, but 10 degress is too much I think. I'm adding less than 1 degree and that's seems working. However ball moving is still glitchy a bit.

    Btw I've tried physics based ball with immovebale objects, 0 gravity and circle collision. You won't believe, but ball can stuck and bounce infinitely between walls anyway.

  • I'm trying to make an arcanoid game - ball hits bricks, they disappear, ball hits moving platform, etc.

    I'm using bullet bouncing off solids behavior for my ball. Platform and bricks are solid. Sometimes ball acts weird.

    First - when ball falls vertically (90 degrees) on platform it's difficult to change ball's angle. Sometimes it takes few hits for.

    Second - sometimes ball moves horizontally and start bouncing between walls infinitely with no chance to stop it.

    As I understand bounce angles are rounded somehow to simplify calculations, that's why ball often has perfect 90 or 180 degrees.

    I can make check and add one degree if ball has 90 or 180 degrees angle to prevent stucking. But probably somebody in community has more natural solutions? Maybe latest version of Construct 2 or even Construct 3 has better collisions? I'm not using latest version of Construct 2 because sometimes it crashes on my pc configuration.

deadbus's avatar

deadbus

Member since 26 Feb, 2015

None one is following deadbus yet!

Trophy Case

  • 9-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

11/44
How to earn trophies