Rable's Forum Posts

  • Hi everyone,

    I just started to implement separated animations for my characters and their weapons, and I’m struggling to synchronize them with precision, even though they have the same number of frames and animation speed.

    Just run this code with the debugger, and when an attack is about to be finished, pause and advance step by step.

    You’ll notice that the weapon will get into idle animation one frame before the knight, even though the sword is dependent on the knight attack animation to be finished to launch its idle animation.

    If I move the action in event 4 to event 2, launching the 2 animations in the same event, the problem is STILL there!

    The only workaround I found for that is to put a wait 0 action at the beginning of event 4, but I’m guessing this is not the proper way to do that kind of things.

    Even weirder is that, even when I put the wait 0 action at the beginning of event 4, the idle animations are not synchronized. The sword is 1 tick earlier. And if I don’t put the wait 0 action at the beginning of event 4, then the sword animation is a huge 2 tick earlier than the knight!

    Am I missing something here?

    Is there a much more consistent way to do that kind of animation synchronization that I am not aware of?

    Thanks for your help!

  • Thanks once again for the reply — .

    After thinking about the various solutions, I started implementing 250 new layouts into my game - one per level, with the different elements that were preloaded on each of them. It's quite some work but it's easier to do than I would have though. Good thing you have implemented a preload layout (by name) into the plug-in!

    Using this method and your preloader plug-in, I don't need any preloader screen and Healer's Quest has close to no load time at all, which is huge!

    Thanks a lot for making this wonderful mm_preloader plug-in!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for replying, everything is much clearer now!

    My next game will sure be thinked differently, but for Healer's Quest it's not possible to have all the object at start of layout. I have only one "game" layout and all backgrounds and enemies in the game are created on it. I'll see if it's still possible to do otherwise but it seems like a lot of work considering the "lag" time for what needs to be created is less than one second.

    I just have a last point on which I'd like to have more detailed explanations: what do you mean by "Otherwise you will probably have to preload both before and after the layout starts."?

    It's possible to preload something before the start of the layout? On the previous layout actually? I thought from your post that this was useless because it would get erased from memory, so I'm probably missing something here.

    Thanks for your help !

  • Hi — ,

    I would like to ask you something, just to be sure I’m using your tool correctly.

    Here’s the context:

    Layout 1 has not the object BG1 on it.

    Layout 2 has not the object BG1 on it either, but BG1 is created in the event sheet, on start of layout.

    What’s the correct way to have BG1 preloaded so that I have a smooth transition from layout 1 to layout 2, and no stop at the start of layout 2?

    • Preload in layout 1? (then maybe BG1 is unloaded when going to layout 2 as it’s not present on that layout)
    • Preload at the start of layout 2? In this case does the plugin make a difference from simply creating the object on start of layout?

    Thanks for your help!

  • I'm also waiting for this one. Hope it'll find its way to C3 soon.

  • Also, will those jerky frames on the beginning of layout will ever be taken care off by the scirra? Only construct does that.

    I can't remember on which thread it was discussed, but to get rid of those frames you may try to put all the objects that will be created on this layout on it. Basically put them all on the layout (layout view), destroy them at the beginning of the layout, then create other instances when you need them. That way the new object are already in memory and creating them shouldn't slow down the game.

    If you're doing this already, then I may misunderstand what the problem is.

  • Wonderful, it works now!

    Thank a lot Magistross

  • Hi everyone,

    Is it normal that I can't use logical expressions in conjunction with other expressions in a "set text" action?

    For example, in the code below, the event 2 is working perfectly fine (when deactivating event 3), while event 3 is not working at all (when deactivating event 2). event 3 is always displaying "Paul" whatever the variable value is. I really don't see why...

    Is it a bug, or am I missing something? The same problem occurs in C3.

    (useful link if you aren't familiar with logical expression)

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

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