Construct example game Kiwi Story - question

  • Hi!

    I'm going through the example games for Construct 3, and have been "studying" the platformer Kiwi Story.

    I'm wondering if anybody could explain what's going on in this specific piece of code below. The main thing I'm looking at is the first line in the function "Transition" (for those who haven't gone through the game, this function is a fade in/fade out effect between layouts). Why is the Transition object being destroyed right away?

    As a test, I deleted that line and ran the game. Nothing seemed to change, but I suspect something is happening in the background that I can't seem to put my finger on. Any insight would be appreciated!

  • At the first line of the Transition function, there is no Transition object selected yet which means that "Transition destroy" will destroy ALL Transition objects, and by doing so it will clean up leftover transition objects from previous transitions. After all "old" leftover transition objects are destroyed, a new one is created and the new transition object's size is changed.

  • At the first line of the Transition function, there is no Transition object selected yet which means that "Transition destroy" will destroy ALL Transition objects, and by doing so it will clean up leftover transition objects from previous transitions. After all "old" leftover transition objects are destroyed, a new one is created and the new transition object's size is changed.

    Got it. So at the start of the game, after the first call, there won't technically be a Transition object to destroy yet, so that action will just be passed up. Then each transition afterward will enact the clean-up action of Destroy.

    Thanks for the reply!

  • Imagine if the transition function was called twice, the second time it would destroy the first functions transition sprite before a new one was created.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Imagine if the transition function was called twice, the second time it would destroy the first functions transition sprite before a new one was created.

    Ethan - thank you! The helps clarify it even further.

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