Rable's Forum Posts

  • Thanks for the reply newt , however I have a hard time understanding what you mean.

    First, I guess you mean that n= 360/number of animations, right? Because if I follow your suggestion and state that n=number of animations, then angle/n will return a number between 0 and 45, which I really don't see what I'm supposed to do with. Same with int(angle/n)*n, which will simply return my angle as an integer.

    Next, I'm still in trouble with the -90 AKA 270 angle problem.

    I tried to make something based on your proposal, and here's what I came up with:

    I could use tokenat in conjunction with the loopindex in order to launch animation automatically and use less events, but it doesn't really apply as I use only 5 animation and mirror 3 of them, so I went for the simple version to avoid renaming all the animations.

    Is this the kind of thing that you meant, or did I miss something?

  • Hi everyone,

    I would like to know the best way to refer to angles when I need to check if an object or behavior angle is within a certain range.

    As an introduction, I noticed that when I put an object's angle or the movingAngle expression of a moveto behavior into a variable, the result is a variable ranging from 0 to 359.999

    When I do the same with the angleOfMotion expression of a Bullet behavior, the result is an angle ranging from -179.999 to 180.

    That alone is quite complicated to deal with, as I use both MoveTo and Bullet behaviors in my code.

    Now here's the kind of thing I'm using in my code in order to play the correct animation based on an angle:

    I have the feeling that I am doing something wrong. Is there a more efficient way to play an animation based on an angle than the one showed above?

    By the way the code above works for a moveto behavior. For a bullet behavior (shotAngle variable set to bullet.angleofmotion) I'll have to change every value above 180 by their negative counterparts or it won't work.

    Bonus question : Is there some way to tell C2 that a certain variable is an angular value? i.e. convert every value above 180 to their negative counterpart or the opposite. That would already help me with the 270°/-90° problem.

    Thanks !

  • Maybe you've put a "Scroll To" behavior on another object?

    Rather than scrolling to the player every tick, you could also simply put the scroll to behavior on the player object if that suits your project.

  • The problem with the timer is that if your object takes damage again before the end of the first timer (unless you use a timer of 0?), the timer will only reset and the effect will not be applied.

    blackhornet solution feels more natural to me, but I believe you could also use timers of 0 seconds for that.

    If I'm correct though, functions are triggered immediately, while a "on timer" will not trigger before the end of the current tick (for a 0 second timer), so the function is probably superior.

  • Hi everyone,

    Is it possible that an object who is placed on a layer above another object's layer is actually displayed below that last object?

    I'm not stating this based on the editor's placement, but on the debugger's datas. Even weirder is that I am positively sure this has been working perfectly fine for more than one year, I didn't change anything in that part of my code recently, but now some objects starts passing in front of others while being placed on lower layers.

    I should probably mention that the objects who have that problem are moved in the code from one layer to another regularly (in order to pass before or below the player object in a perspective view). But as the layer placement is correct in the debugger, I'm really scratching my head with that problem.

    I'm using C2 v.244

  • If I'm correct Game Maker Studio 2 is also using a subscription model now. It's 800$ per year for exporting to only one specific console.

    And to reply to the original question, no I didn't switch to C3 yet, but I'm planning to do so in the future. The main reason why I didn't do it yet is that as many others, my current project is dependent upon third party plugins which aren't supported at the moment. I'm also waiting for the desktop build as I have a hard time getting used to the browser based engine to be honest. I also hope performances (of the editor) will be better on the desktop version.

  • Hey guys,

    I posted a question about this particular topic a few days ago, and got fully replied. With additional search I now understand this tricky thing.

    You can read the post here :

    Though Ashley's visual explanation is probably the only thing you need. Couldn't be clearer.

    I hope it helps.

  • Problem Description

    When replacing an object (press R) in an action setting an effect parameter, we can select objects which don't have that effect on them. If we do so, the action disappears without any notification.

    Attach a Capx

    https://www.dropbox.com/s/lrzmxryqdcfpv ... .capx?dl=0

    Description of Capx

    A basic project with 2 sprites. One has the effect applied to it, the other don't. There is a single action which set Sprite1's effect parameter to a value. Just select the action, press R, select the other object --> the action disappears.

    Steps to Reproduce Bug

    • Create 2 sprite objects
    • Add a "adjust HSL" effect to one of them.
    • Create an action where you set the effect parameter to any value.
    • Select the action and press R, select the other object (which doesn't have the effect)
    • The action disappears

    Observed Result

    The action is deleted

    Expected Result

    The object which doesn't have the effect on them should not be selectable, or an error message should appear. Deleting the action without any notice is not a good idea.

    Affected Browsers

    editor bug

    Operating System and Service Pack

    Windows 10 / v10.0.14393

    Construct 2 Version ID

    244 (64 bit)

  • Oh wait...

    It's a bit tricky, but based on R0J0hound 's comment in the link you provided, there is a workaround based on the UID of the object, as "pick by UID" is an exception.

    For anyone interested, this should be learned:

    There are three lists internally:

    Instance list

    New list

    Sol list

    By default the sol list will be the instance list, which you then filter. When you create an object it's added to the new list and the sol is set to it. The pick all sets the sol to the instance list and since the new list isn't added yet those objects aren't picked. Then at the next "top level" event the new list is merged into the instance list.

    You can search the forum for "top level" for some more discussions/explanations of this. In one of the change logs had a fix where before "pick all" would pick the new ones too. This was fixed to prevent cases of infinite loops.

    Alternatively the pick by uid can pick objects from the new list. It's the exception to the rule.

    So I tried this:

    ...and it works! I can refer to the newly created object without needing a top event or a wait 0 seconds event.

    For further explanations by Ashley, refer to this post.

    [EDIT] It may be even simpler by using "function.returnvalue" instead of a global variable if there is only one object created in the function that you need to refer to.

  • Thanks for the reply. Very interesting. It means that it doesn't apply only to functions but to all created objects which should be accessed not directly below the "create" action.

    So wait 0 or put the modification in the next top event are the only solutions. It explains many things and is definitely something important to know.

    Thanks again!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • TL;DR : when created in a function, objects need a wait 0 second event before they can be modified. Is there any better way to access an object that has just been created in a function?

    [EDIT] : Solved, see below.

    Hi everyone,

    I would like to ask you something I’ve run into multiple times and makes me scratch my head. Hopefully you can help me better understand how functions work.

    I noticed that when creating an object inside a function, you can’t access this object directly in the event which called the function.

    This will only set to scale 0.2 previously existing sprites.

    ***

    However, you can access that object by inserting a “wait 0 seconds” event just after the function.

    This will set all object to scale 0.2 including the newly created sprite.

    ***

    When the object is already created, modifying it in any way takes effect immediately.

    For example you can set an existing object instance variable in a function, then in the same event that called the function access this object based on this newly set instance variable without waiting 0 seconds.

    The object is immediately destroyed.

    ***

    It goes as far as making a function which set an object’s instance variable, then creates a new identical object with the same instance variable set to the same value –

    Then in the event which called the function, deleting all objects with that given value, will only destroy the old object, not the new one.

    Only the old objects are deleted. The newly create object is not deleted, even though its number value is correctly and immediately set to 5.

    ***

    Please note that everything behaves exactly the same in C2 and C3.

    So I have to questions:

    1) Is it normal? How do you explain that behavior?

    2) What is the most correct way to access an object which was newly created in a function

    You can find the Capx with the different tests here : https://www.dropbox.com/sh/u73o34q4a3pz ... 9VKga?dl=0

  • Thanks for taking the time to explain that. It makes sense but I agree that obvious entries should be returned first, so I'll make a bug entry as you propose.

  • Hi,

    I don't post this as a bug as I'm not sure if it is intended or not. I have personally a hard time with how C3 manages the way we can type into the text field on "add action" and "add condition" dialogs.

    For example, in C2 I used to type C > enter > tr > enter

    and very quickly I added a "trigger once while true" condition to my event.

    In C3, typing "tr" after selecting system, will focus on "compare two values". (!)

    instead of "tr", the shortest string I can type to focus "trigger once while true" is "ger " which is 2 times longer, but the real problem is that we'll have to learn new fastest method to access such actions when switching to C3.

    Another example is that "compare two values" could previously be accessed by entering "co", while in C3 you have to type as much text as "compare t" for it be focus. Curiously, and as stated before, just entering "tr" selects "compare two values".

    I really have a hard time to find the logic behind the new way to select actions/condition in dialogs with the text field, which is the way I'm working 99% of the time. Would it be possible to let us know the logic behind that, or tell us if the current way is definitive or if it will be changed to be closer to the experience we had with C2?

    Thanks a lot!

  • Amazing! Thanks a lot rexrainbow , I haven't been able to reproduce the bug since the new update.

  • OddConfection

    That's a clever idea!

    I tried it (with browser orientation), and the result is sadly not what we would expect. The layout indeed rotate 90 degrees, but the window doesn't change size and doesn't rotate (I'm in letterbox scale fullscreen mode). So basically if you're holding your phone in portrait, you've got a small horizontal window in the middle , with the layout inside it rotated 90 degrees. You see a part of the rotated layout in the middle and large white borders on the left and right of the small window.