Hello, I have a game logic problem that block me from month :
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) :
1.Create BlueTriangleR on Layer 2 at(752,70)
2.set bullet angle of motion to 90 degrees
3.set bullet Enabled
this bluetriangler is bullet enemy?
can you post full event so we can see all the event before or send us a capx
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.
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.
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.
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.
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.
Develop games in your browser. Powerful, performant & highly capable.
Thanks 99Instances2Go !