S
S
sanya1642014-08-20 04:53:20
iOS
sanya164, 2014-08-20 04:53:20

How to do "OR" in Construct 2?

I'm worried about the following question:
I want to make it so that for example:
The level starts, after 3 seconds 1 object ( or ) 2 object is created.
I know about time, but I don’t know how to do " or "

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
EXL, 2014-08-20
@sanya164

I don't know what construct 2 is, but I would do something like this:

[email protected]:~/Projects/genobj > cat main.cpp 
#include <iostream>
#include <cstdlib>

int main()
{
    srand(time(0));
    std::cout << ((rand() % 2) ? "Object #1" : "Object #2") << std::endl;
    return 0;
}
[email protected]:~/Projects/genobj > g++ main.cpp
[email protected]:~/Projects/genobj > for ((a=0; a < 10; a++)) do ./a.out; sleep 3; done
Object #2
Object #1
Object #2
Object #2
Object #1
Object #1
Object #1
Object #2
Object #2
Object #1

That is, look towards random number generation in construct 2.

M
Maxim, 2016-01-18
@Zzombik

I've been digging a little into this constructor. There, I don’t remember exactly, but there seemed to be a random command. In general, we generate a random number 1 or 2, then we write "if the number is 1, then 1 object is created", otherwise "2 objects are created".
There is an awesome site with a live forum about this constructor. And a slightly outdated tutorial: c2community.ru/doc/tutorials.html .
If you don't find the answer in the tutorial, use the search on the forum or create a new topic with the question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question