couple of questions

0 favourites
  • 8 posts
From the Asset Store
A collection of various characters spritesheets for creating a 2D top down, RPG, tower defense, or other similar game.
  • Hi,

    I have some questions, regarding the use of construct2 that I could not find in the examples, tutorials... I don't want to create separate topics for each as they are small

    Regarding the use of the event page

    1) OR Condition missing

    As far as I understand adding another condition to an existing one is a AND operation. What I often need is a OR operation. I can do it with a workaround, but I feel it should be far easier to do. See the cap here:

    http://dl.dropbox.com/u/40417570/Tests/questions.capx

    2) Else Condition missing

    Similar to 1) Creating an else case for a complex statement is basically duplicating code (and inverting it)

    3) Local Variable appears in wrong scope

    Example: I create a for loop and another for loop inside. I then want to create a local variable in the inner for loop. I highlight the inner for loop and select add local variable. The variable is created in the scope of the first loop. (see the capx above)

    4) No booleans in local/global variables

    Topic says it all. I can't find it. Why?

    Possible bugs (not event page related)

    5)Flash effect doesn't work for text elements

    create a text object. Add a Flash effect. Run-> text not blinking (not visible at all)

    6)How to manually trigger fade effect

    Add fade behavior to sprite. Always gets triggered at object creation. How can you trigger the fading with an event? It's used in the lazer version of ghostshooter, but here objects (death flash) are created on events and then fade out, that's something else.

    7) object time scale doesn't work on all objects

    While it works well on the player (having the 8-direction behavior). It doesn't work on other sprites. See example capx above. Note that I used delta time (dt) as in the tutorial here:

    http://www.scirra.com/tutorials/67/delta-time-and-framerate-independence

    Thanks in advance for helping me out.

    Ps: the preview button in the "create new topic" in this forum doesn't work either...

  • Lots of questions but here is one answer.

    scirra.com/forum/or-if-elseif-else-while-etc_topic45788_post286613.html

    This will show you how to do your "Or" and "Else". Thanks to a guide by R0J0hound

  • 3/ Using local variables - A bit more about local variables

    4/ Probably becasue it wasn't implemented. At worse, use an object in your layout (the player for example) if you need absolutely booleans.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the answers.

    Guyon: This is exactly how I did it in the posted capx. But at least now I know that there is no easier way. They should add OR and Else to the event page, it's a pain to work like this.

    Kyatric: The question was more subtle, I know what local/global means. However what I meant is that having two loops, the only way to add a local variable "that is accessible only within the inner loop (second loop)" is to add another sub-event, to be able to click on that subevent and create the local variable. If I click on the inner loop condition and select "create local variable", the variable is declared in the outer loop (first loop). It's still accessible in the inner loop, but not only (that was the point). Nevermind, I know how to cope with this, but it's irritating. Thanks anyway.

  • Your question still doesn't make full sense to me, and that's why I linked to the topics, where there is an example of variables scope.

    In your capx, I don't see the problem in the scope group, except that you use two for each loops on the same object.

    As it is, the local variable is accessible for the second loop, but not the first one, as you seem to want it, so I don't see how its scope is wrong.

    Also you can drag/drop the variable and modify where it is placed even if it was created in the wrong spot, so I really don't see the problem there.

    What are you trying to do exactly ?

  • Thanks for the answers.

    Guyon: This is exactly how I did it in the posted capx. But at least now I know that there is no easier way. They should add OR and Else to the event page, it's a pain to work like this.

    There is this plugin. I haven't tried it, but you might check it out.

  • Kyatric, I changed the capx and added comments. I replaced the outer loop with a simple condition, to make it less confusing. The capx represents this (in pseudocode):

    System->onEveryTick{

       int VariableInWrongScope = 0;

       foreach (TestObject in TestObjectList) {

          VariableInWrongScope = TestObject.MyInstanceVariable;

          if (VariableInWrongScope == 0) {

            TestObject.setInvisible();

          }

       }

       // is correct, but I don't want it accessible here

       if(VariableInWrongScope == 0) {}

    }

    What it should look like (but seems not possible) is this:

    System->onEveryTick{   

       foreach (TestObject in TestObjectList) {

          int VariableInCorrectScope = 0;

          VariableInCorrectScope = TestObject.MyInstanceVariable;

          if (VariableInCorrectScope == 0) {

            TestObject.setInvisible();

          }

       }

       // this won't work (this is what I want)

       if(VariableInCorrectScope == 0) {}

    }

    Maybe I misunderstand the structure of events and actions. It's also not critical (I can live with the broader scope)

  • Noga, cool and thanks, that's exactly what I need! I'll have a look how to create custom plugins, this seems to be quite powerful.

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