0 Favourites

Should I use "on every tick" or pin for sprite skins?

  • In the excellent jungle platform tutorial, we are taught to attach an invisible placeholder box to the player skin. As part of that tutorial, we learn how to use the "on every tick" event to attach the skin to the placeholder box.

    In other tutorials and examples, people use the pin behavior to attach a sprite skin to a placeholder box. This also seems to work just fine.

    Is one of these approaches recommended over the other approach? In a way, the pin behavior seems slightly more elegant because you just need to do it once rather than having the command executed in your event sheet on every tick. But I guess the pin behavior is probably doing the same thing underneath the hood?

    Thanks for any advice!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • i tend not to use much behaviors, in this case i personally would do Every tick -> Set position of PlayerSkin to both HitBox.X and .Y

    of course, if that's what you want to do (it's what i could understand)

  • What if you were doing this with a collection of enemies? For example, imagine that I had 12 fox enemies with their own skins. Would this still seem appropriate?

    I guess I am wondering if there is any advantage of doing it one way?

  • What if you were doing this with a collection of enemies? For example, imagine that I had 12 fox enemies with their own skins. Would this still seem appropriate?

    I guess I am wondering if there is any advantage of doing it one way?

    well there are tons of different cases with different solutions, for the player i just use the every tick

  • Behaviours are there to make your life easier, and typically will run more efficiently since they are native JavaScript, as opposed to the engine having to do the overhead of decoding events. In this particular case there isn't going to be a huge difference. Do what's easier for you.

  • Thanks, everyone. I appreciate the advice, and it makes sense that native JS will run faster than it would if the engine is required to do the overhead.

  • just keep in mind when using every tick make sure that you arent using too many at once. Cause ive seen it rubberband lag me to no end when debuggin even in devoloper mode.

  • Pin always when you need something pinned on a moving object, else, pin and unpin. Try avoid check too much events at once in everytick and if possible use "triggers" and "else" where possible to make your events light, running only the necessary.

    You'll see it and understand better while you mature your usage of C2.

  • Thanks, Gabriel. This makes sense. It does seem logical that pinning and triggered events would be more efficient than using once every tick. I wonder if someone should update the "jungle platform tutorial" to emphasize the use of pinning rather than on-click events. Hmm... I'll just add a comment to the bottom of that tutorial.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)