# A small LOGIC PROBLEM.

Get help using Construct 2

### » Wed Aug 24, 2016 10:52 am

Hello, I have a game logic problem that block me from month :

Scenario :
INITIALISATION : Each cube have bullet behavior disabled.

PROCESS : Every 5 seconds :
An random variable is created with int value (column)
A cube is spawned at a given position depending on the random int value
His bullet behavior is enabled so the cube can fall
At a given position depending on the column the cube bullet behavior is disabled.

Here is the problem. How I can do this ?
Here the current event sheet (a triangle is used, not a cube) :
B
6
S
2
Posts: 42
Reputation: 538

### » Wed Aug 24, 2016 11:11 am

1.Create BlueTriangleR on Layer 2 at(752,70)
2.set bullet angle of motion to 90 degrees
3.set bullet Enabled
4.max speed??

this bluetriangler is bullet enemy?

can you post full event so we can see all the event before or send us a capx
B
17
S
7
G
7
Posts: 205
Reputation: 5,335

### » Wed Aug 24, 2016 12:31 pm

Here the full event :
The bullet speed is already specified in the main triangle; the problem is how to stop the triangle (disable bullet) when he arrive to a given position, and applies also for other triangles that will be spawn after.
B
6
S
2
Posts: 42
Reputation: 538

### » Wed Aug 24, 2016 12:46 pm

Many ways to do is. Not necensary using 'bullet'.

Depends on what exactly 'position' in 'when he arrive to a given position' means.

A certain Y ? Easyer to use the MoveTo plugin.
behavior-moveto_t63156

When colliding with an underlaying object ? Easyer to use the platform behavior.

Or many other ways. Just need to know what exactly that 'position' means. Let me know and i make you an example with 1/6 of the code you use now.
B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

### » Thu Aug 25, 2016 7:13 am

A position already specified in comments "Columns transform initialisation" for the column 1 it's 752;700 (X;Y),when Y is 700 the object have to stop.
I will use the MoveTo plugin, I did not know it previously. Thanks.
B
6
S
2
Posts: 42
Reputation: 538

### » Thu Aug 25, 2016 7:47 am

Okay. Still.

You dont need all this code. By example (one of the many) ....

Place invisible sprites on top of your layout, positioned so the represent every kolom.
Give them a instance variable 'fall' representing the Y things have to move to. (or any other system for that Y)
Say, we call that sprite 'Column'.

Then just ... random and spawning in a few lines of code ...

Condition > System > Every x seconds
Condition > system > Pick random Column
...........Action > Colum > spawn triangle
...........Action > moveto ... (start is Column.X and Column.y)

The whole code in 4 lines.
B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

### » Sat Aug 27, 2016 8:26 am

Thanks 99Instances2Go !
B
6
S
2
Posts: 42
Reputation: 538