Spawning Preset

Get help using Construct 2

Post » Wed Jul 25, 2012 7:23 am

Hello guys. Two Questions:

1) I need to make a sprite spawn some fireballs at determinated positions, many times, in a order that I want.

Let me explain better.

I have a Witch who spawns 4 fireballs at 5 random locations.

How can I create a preset, I mean, how can I pre determinate the order and the position at which the fireballs are spawned, without consuming a lot of my time on the process? That's because the witch will spawn about 100+ FireBalls per stage.

2) Actually, i'm using this code:



But sometimes, some fireballs are spawned at the same Y Coordinates. How can I set them to spawn exactly four, but always at different Y? (being it 100, or 200, 300, 400 and 500)

Appreciate the help!Zerei2012-07-25 07:24:42
B
6
Posts: 56
Reputation: 712

Post » Wed Jul 25, 2012 2:49 pm

For the first fireball you want spawned put like every 5 seconds or something then spawn it at the position you want.
Then do the same but every 5.6 seconds then the next one 6 seconds and so on and so on. Is that what you needed?
B
29
S
7
G
3
Posts: 361
Reputation: 6,187

Post » Wed Jul 25, 2012 3:16 pm

Use a loop when creating the objects, every time the loop runs, add 1 to a variable "varY" and create an object at random X and 100*varY.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Jul 25, 2012 3:35 pm

Guess it's more like Nimtrixs said. Can you explain me better , how to use this loop?
B
6
Posts: 56
Reputation: 712

Post » Wed Jul 25, 2012 3:56 pm

You can use any kind of loop, really, but here's an example of the "While" loop:
WhileLoop.capx (r99)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu Jul 26, 2012 3:55 am

Thanks! Now things get complicated.

Let's say I have this CSV file, with 5 lines and lets say, 20 columns.

How do I make the construct read this CSV, and if, at the column 1:

Line 1 value is 1, spawn one fireball at Y = 100,
Line 2 value is 3, spawn three fireballs at Y = 200
Line 3 value is 0, spawn 0 Fireballs At Y = 300
Line 4 value is 1, spawn 0 Fireball at Y = 400
Line 5 value is 2, spawn Two Fireballs at Y = 500

Did I make that clear? Then, after let's say, two seconds, the cicle goes on, but now reading column 2. Then3, 4, And So on.

Please, somebody help :(
B
6
Posts: 56
Reputation: 712

Post » Thu Jul 26, 2012 4:14 am

Here is an example of a CSV:


CSV,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
First,1,2,1,1,1,0,1,2,2,0,3,0,2,0,0,1,1,1,2,12
Second,2,2,0,1,2,1,1,1,2,1,1,0,2,3,3,3,1,2,2,0
Tirth,0,0,1,0,0,2,1,0,3,1,3,0,2,1,3,2,3,0,0,0
Fourth,1,0,3,1,3,2,0,2,3,2,3,1,0,2,1,0,2,3,2,0
Fifth,0,0,0,1,2,0,1,1,0,1,2,0,1,0,2,2,0,3,3,0

The idea is to spawn that amount of fireball at Y (100, if in the first line, 200 if in the second, 300 thirth, 400 fourth, 500 fifth) at every 2 seconds, for example. This is done, let's say, 40 times at the first stage and 60 at the second.

Please tell me if my question is clear enough.Zerei2012-07-26 06:10:56
B
6
Posts: 56
Reputation: 712

Post » Thu Jul 26, 2012 6:49 am

Looks like I managed to read the CSV. But I can't spawn 2 or more FireBalls =\
B
6
Posts: 56
Reputation: 712

Post » Thu Jul 26, 2012 2:44 pm

B
27
S
8
G
8
Posts: 903
Reputation: 8,452


Return to How do I....?

Who is online

Users browsing this forum: Aritz, gamecorpstudio, mallorcaredes, ultrafop and 2 guests