How do I spawn a object with random x position

  • Hi there

    Im looking for a way to spawn a object (Bullet) at the imagine Point with a variable X position. I want to spawn more than one bullet. But i want that they dont spawn at the same time at the same point. It should spawn a little bit one after another. I have try to set a wait function bevore. It seams to work but when i shoot in other direction the Bullets sometimes change the direction.

    So i think about to spawn the bullets like that: Spawn Bullet at imagine Point 0 + X (random(1,2)). But i dont know how to write it correctly. Can anyone help me?

    Thanks

    Edit:

    Solved. I have give it up to try to make it into the spawn call. I make a extra line how set position.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So, I see you've solved it but I actually had this problem at one point and your solution isn't how I solved it. It could be a "tomato, tahmato" thing but this info may help?

    for every X instance > system > create object ___ > at [random (Z, Z), random (Z, Z) So if the trigger is pressing the space bar then, depending on your layout size and where you want the spawn, the system will create the item randomly between the two X coordinates, and between the two Y coordinates listed -- every time the space bar is pressed. You can also do a random trigger for the spawn: system > every random (1, 20) seconds > spawn bullet, etc. Sorry if this doesn't help at all -- not sorry if it does.

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