couple of questions

Get help using Construct 2

Post » Wed Nov 16, 2011 9:30 am

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...
B
33
S
7
G
6
Posts: 34
Reputation: 4,815

Post » Wed Nov 16, 2011 2:24 pm

Lots of questions but here is one answer.

http://www.scirra.com/forum/or-if-elseif-else-while-etc_topic45788_post286613.html#286613

This will show you how to do your "Or" and "Else". Thanks to a guide by R0J0houndGuyon2011-11-16 14:24:36
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Wed Nov 16, 2011 5:03 pm

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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Nov 16, 2011 10:44 pm

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. drpool2011-11-16 22:46:44
B
33
S
7
G
6
Posts: 34
Reputation: 4,815

Post » Wed Nov 16, 2011 11:53 pm

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 ?Kyatric2011-11-16 23:55:02
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Thu Nov 17, 2011 12:09 am

[QUOTE=drpool] 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.[/QUOTE]

There is this plugin. I haven't tried it, but you might check it out.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Thu Nov 17, 2011 8:46 am

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)
B
33
S
7
G
6
Posts: 34
Reputation: 4,815

Post » Thu Nov 17, 2011 8:48 am

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.drpool2011-11-17 08:59:48
B
33
S
7
G
6
Posts: 34
Reputation: 4,815


Return to How do I....?

Who is online

Users browsing this forum: YoHoho and 12 guests