W
Wild_West
Guest
I'm working on a new project that centers around using a series of numbers held in an array to allow the player to manipulate different objects.
I have my setup all done, but there;s one thing I can't figure out.
I want to be able to stop any object interacting if the array that holds the number codes it needs doesn't have that object's specific number code.
Like if an object's specific needed code to operate was "0001" and that number combination didn't exist anywhere in the code array the player has, then don't do your function.
The problem is how do I do that by looping the array and NOT checking for all the extra array positions?
Because I was playing around with one of these objects that affects gravity and I can't get it to work if the check for the array NOT holding it's numbers code is in the loop.
The loop itself works fine but since other array positions don't have those numbers it checks for it cancels the functionality of the object anyway. I tried using break and continue but I didn't get it to work. Any tips how I should do this?
I have my setup all done, but there;s one thing I can't figure out.
I want to be able to stop any object interacting if the array that holds the number codes it needs doesn't have that object's specific number code.
Like if an object's specific needed code to operate was "0001" and that number combination didn't exist anywhere in the code array the player has, then don't do your function.
The problem is how do I do that by looping the array and NOT checking for all the extra array positions?
Because I was playing around with one of these objects that affects gravity and I can't get it to work if the check for the array NOT holding it's numbers code is in the loop.
Code:
///In the Gravity_globe object's step event
if( distance_to_object(gearz) < 100) and (gearz.barrier == true)
{
for( var i = 0; i < 6; i += 1 )
{
if( gear_sphere.key_code_bank[i] == key_code) and (gear_sphere.ui_target = self)
{ keyboard_string = ""; gravity_on = true; }
if(gearz.barrier == false){ gravity_on = false; }
}
}