Spawning Preset

0 favourites
  • 9 posts
  • 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:

    <img src="http://img269.imageshack.us/img269/3945/semttulooa.png" border="0" />

    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!

  • 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?

  • 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.

  • Guess it's more like Nimtrixs said. Can you explain me better , how to use this loop?

  • You can use any kind of loop, really, but here's an example of the "While" loop:

    WhileLoop.capx (r99)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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 :(

  • 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.

  • Looks like I managed to read the CSV. But I can't spawn 2 or more FireBalls =\</p>

  • Like this?

    TokenLoopSpawning.capx (r99)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)