How do I Randomize an Object that Spawns?

0 favourites
  • 3 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hey all,

    I'm trying to figure out how to get a spawn point to randomize the object it spawns every time the layout gets loaded. For example, I'm making a Breakout-style game and every time the layout is started, I want the 'brick' objects (the objects you hit with the ball), or in my case 'barnacles', to be a different style.

    I've got 4 different barnacles that I want the game to choose from, but I don't know how to get the game to choose a random barnacle to spawn. Any help would be much appreciated. Thank you!

  • hiya, assuming it's as described with tiles spawning on spawn point, create an instance variable on the spawn point object. Then have on start of layout 'for each spawn point' set instance variable to choose(1,2,3,4). This will give each spawn point a random number. Then you relate the number to created tile i.e. if spawnpoint.variable=1 spawn block A, if spawnpoint.variable=2, spawn block B etc

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That worked! Thank you!

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