• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Contrilling new instances from a primary point

J

JorgeDamien

Guest
I’m trying to set up a note spawn system for a rhythm game, but I’m having some trouble getting notes to spawn. I’m trying to create a system where each note has a spawn point outside of the viewable window, and whenever a note needs to be played, a new instance of that note is made and then sent downward on the Y axis to be played. The problem I’m having is getting notes to spawn from the base object, outside of view. What I have so far is that the note outside of view creates a new instance of itself, but I can’t seem to figure out how to make that new instance have a unique ID, and how to then reference it later to make it go downwards with the correct speed. Simply put, how would I go about referencing a newly created instance’s ID from the object that created it? How would I be able to ensure each new instance has a unique ID, since there may be many of that note on screen at a time?omegle discord xender
 
Last edited by a moderator:
H

Homunculus

Guest
Every instance has its own id, you can get it in various ways, but usually you want to store the result of the instance_create_* function to a variable and use that to reference it.

I do find your spawning system a bit odd though. First of all, a common way to spawn something at specific times or intervals is by using a spawner, or in other words, an object that is in charge of creating new instances only, and is different from the instances it spawns.
Moreover, do you really need to create the instances beforehand? Can't you simply create them exactly when they are supposed to start moving downwards, and set the correct speed at creation? Seems simpler, but maybe you have your own reason for that...
 
Top