Rable's Recent Forum Activity

  • Just press F11 to play Chrome in full-screen mode. Press F11 again to revert to windowed.

  • I think I find a way to implement the 3 mirrored animation as well. It saves 3/8 of the memory, weight, etc. so it isn't even an option to implement mirrored animations in the animation editor. I did the test just to be sure, and if you mirror a sprite into the animation editor, it will be a different sprite when exported.

    Here's the code:

    Basically, I consider that top is 0°, right is 90°, left is -90°, etc. I named my 5 animations accordingly and play the animation based on this new angle.

    If the variable has a negative value, the animation is simply mirrored.

    Best of all, it automatically convert all 180+ angles to their negative counterparts, so no more confusion between MoveTo's 0-360° angles and Bullet's -180/180° angles.

  • newt

    Unconnected

    Thanks a lot! Very clever way to achieve that in only one event!

    For future reference, here is the code provided by newt. I just added 22.5 to the variable angmo in order to have the zombi move right if I click at a -0.1 angle from him (otherwise he's moving up-right, which is unnatural):

    set angmo to int((angle(touch.X,touch.Y,Sprite.X,Sprite.Y)+22.5-180)/45)*45

    The second event is just to display the angle values.

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

Rable's avatar

Rable

Member since 6 Aug, 2014

None one is following Rable yet!

Connect with Rable

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies