deadbus's Forum Posts

  • 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:

  • 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.

  • Hello! I'm making game, and there will be some inventories in rpg style (bags with items?.

    I'm thinking about way how to create them. I think about 2 ways:

    - precreate inventories with all items in them (like 3 bags with 20 items in each bag) and make them invisible before player opens them.

    - create all menus with slots and items when player opens bag and destroy it when he closes bag.

    Both way have their downsides: invisible objects will be kept in memory, while creating and destroying objects every time when bag is opened or closed doesn't look good too.

    Maybe you can give me some advices, which way is better?

  • Does system calculate graphics if visible object overlap invisible? I worry about perfomance and fps. I know if one object overlap another one, system must calculate lot of graphics.

  • Thanks for your help guys. Problem was in code - end game action was activating when it shouldnt.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > I'm not sure will this objects be clickable if they will be invisible on separate layer (or if they will visible on invisible layer)? There is some buttons, and I don't want them to be clickable while game is not over.

    >

    Just put these buttons in a separate layer. Turn this layer visible in your game over conditions and invisible in gameplay. Put conditions in your buttons to user click them only when layer is visible.

    Ok I get it, but I looked once again, and I think it won't solve problem. On Start action else have to reset some variables, but it doesn't happens.

  • You likely have set those objects as global or something.

    Consider posting your capx for further examination, that will be easier to establish what's going wrong.

    No, it's not global. Maybe I'm wrong and On Start Layout action starts just once - when I first time on this layout, and after that I have to use Restart Layout action?

    It's easier you hide and show these non-game objects with a separate layer.

    I'm not sure will this objects be clickable if they will be invisible on separate layer (or if they will visible on invisible layer)? There is some buttons, and I don't want them to be clickable while game is not over.

  • On Start Of Layout action doesn't work after returning from another layout with Go To Layout action.

    On game layout I have game objects and non game objects (like high scores text and words "game over").

    On Start Of Layout event destroys all non game objects, and when game ends I create them again.

    After that I'm going to another layout and then back with Go To Layout action. But On Start event is not working this time, I see same objects that I had on the end of game: high scores text and words "game over". Why it's not destroyed? What I'm doing wrong? Before I was using Reset Global Variables, but right now I can't use it, because different variables loading from WebStorage on different layouts.

    Upd: Thanks for your help guys. Problem was in code - end game action was activating when shouldnt.