Generating a random object in specified area?

This forum is currently in read-only mode.
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I'm making a simple turret game and I want the enemy to randomly spawn somewhere within the layout (it will then proceed to travel towards the turret/player who must shoot it, etc.)

    I can't for the life of me figure out a good way to get the baddie to respawn within a random area around the turret to generate a repeated assault upon the turret. I've messed with Create and create at offset to object, etc. and my current try is generating a random x and Y which yields no new creation (as opposed to other methods which worked, but didnt create the random spawning result i want) Here's my event screen so far.

    <img src="http://i.imgur.com/beUvg.png">

    Right click view to get the whole picture.

    Any ideas? Again, trying to get baddies to spawn around the turret. Thanks in advance for help.

    Here is a WIP link to my .cap http://www.mediafire.com/?5vp493h2rzdyaqa

  • Hopefully this is what you were after, you can change the global variable "SpawnDistance" as needed, it currently spawns the enemies 128 pixels away, or you could even randomize the spawn distance the same way i randomized the spawn angle.

    Note: I saved this in 0.99.96, and it said you saved it in an older version, so you may need to upgrade to open it.

    http://dl.dropbox.com/u/6660860/spawns.cap

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Perfect!! I didn't get the highest grades in programming or math so this helps me very much!

    Thanks for reminding me to update too...!

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