[SOLVED]Problems with Alchemist Table

So,

I'm having trouble with switching rooms. When I go into my alchemist lab from the main room and return to the main room, it doesn't spawn enemies anymore. Below is the code for the alchemist lab process flow. The main room is called the alchemist lab and the exit sign is used to leave the alchemist lab.
I'm having one more problem. I want the player to be able to click more than one object in the alchemist lab. Right now I can only choose one item and if yu leave and come back you can't pick that object again.

Cheers

Ted



Code:
/**********/

Exit Sign Object

global.a_choose = true;
mouse_enter = true;

///////////////////////THESE VARIABLES ARE TO PREVENTS "OVERFLOW" AND SO THE PLAYER//////////////
//////////////////////CAN ONLY CLICK ON ONE THING PER THING AT ONCE////////////////


global.non_usable = true;    //?/
//global.can_click = false;            //can you click on a item in the lab //  ?
//global.can_click_myTimer = room_speed/2;      //delay for clicking on the tab ?



global.alchemist_myTimer = room_speed*10; //timer for alchemist table
//global.clicking_myTimer = room_speed/15;
global.can_click  = false;
global.alchemist_lock = true;    //if alchemist lock is set, you can't click on the same place  twice (keeops it from "overflowing"
room_goto(global.RoomBeforeAlchemist);      //go back to main room

with (SimpleBrain)
{
    depth = -1800;
}
[CODE]
ALchemist Table Object



    a_choose = true; //you can choose one thing fromt he alchemist lab   
 
    //scr_save_game();
    if (global.alchemist_lock == false)
    {
        room_persistent = true;     //persistence for main room
        audio_play_sound(AlchemistLabOpenSound, 20, false);
        global.RoomBeforeAlchemist = room;        //save main room
        room_goto(AlchemistTableRoom);             //go to alchemist room
        draw_set_colour(c_black);
    
    }
// Only run the un-pause code if we [/CODE]

[EDIT]
Basically the problem in a nutshell is it doesn't spawn enemies if I use the alchemist lab.
Simple as that.
 
Last edited by a moderator:

zATARA_0

Member
Is the Alchemist room persistent? Maybe you have a global variable that needs to be reset? Generally its not a great idea to use lots of global variables.
 

zATARA_0

Member
since the alchemists room is persistent if the enemies spawn only when the room is created they will only spawn that first time, and if the enemies are not persistent they will be destroyed when you switch rooms, however if the enemies are persistent they will be in the next room too...
 
Almost. The enemies don't just spawn when the room is created. They consistently spawn throughout the level.I can leave the room and come back and the enemies are still there. They just don't create new ones. The room is persistent but the enemies aren't
 
Where is the code that makes the enemies spawn?
It is in the BrainMaster, the controller for the Brains.

This is the spawning code:

Code:
global.current_level = 1;

if (!global.game_win_flag == true && !global.you_lose)
{

//global.current_level = irandom_range(1, 5);


//myTimer creates the brains
        if ( global.number_of_brains_on_screen <= global.max_number_of_brains && global.current_level == 5 && myTimer <= 0 && !global.petrification && !global.freeze_brains && !global.terror)
    {
        random_y = irandom_range(400, 522);
        
        
        door = instance_create_depth(2000, 1200, -1100, CastleDoorObject);
        
        sprite_index = FrankensteinSendOutBrains;
        
        
        brain_inst = instance_create_depth(1600, 1200, -1800, DrillBrainObject);
        /*with (brain_inst)
        {
            path_start(path8, 5, path_action_continue, false);
        }
        */
        audio_play_sound(DrillBrainDrop, 15, false);   
        global.number_of_brains_on_screen++;
        if (global.easy_difficulty)
        {
            myTimer = room_speed*50;
        }
        else if (global.medium_difficulty)
        {
            myTimer = room_speed*40;
            
        }
        else if (global.hard_difficulty)
        {
            myTimer = room_speed*30;
        }
        else if (global.doom_difficulty)
        {
            myTimer = room_speed*13;
        }
    
        
        x += 100

    }

    //LEVEL 4 - Laser Brain
    
            if (global.number_of_brains_on_screen <= global.max_number_of_brains && global.current_level == 4 && myTimer <= 0 && !global.petrification && !global.freeze_brains && !global.terror)
    {
        random_y = irandom_range(400, 922);
        
        
        door = instance_create_depth(2000, 1200, -1100, CastleDoorObject);
        
        sprite_index = FrankensteinSendOutBrains;
        
        audio_play_sound(LazerBrainDrop, 15, false);   
        brain_inst = instance_create_depth(1800, 1200, -1800, LaserBrainObject);
        with (brain_inst)
        {
            path_start(path8, 5, path_action_continue, false);
        }
        
        global.number_of_brains_on_screen++;
        if (global.easy_difficulty)
        {
            myTimer = room_speed*50;
        }
        else if (global.medium_difficulty)
        {
            myTimer = room_speed*40;
            
        }
        else if (global.hard_difficulty)
        {
            myTimer = room_speed*30;
        }
        else if (global.doom_difficulty)
        {
            myTimer = room_speed*13;
        }
    
        
        x += 100

    }



    //LEVEL 3 - Scorpion Brain
    
        if (global.number_of_brains_on_screen <= global.max_number_of_brains && global.current_level == 3 && myTimer <= 0 && !global.petrification && !global.freeze_brains && !global.terror)
    {
        random_y = irandom_range(400, 922);
        
        door = instance_create_depth(2000, 1200, -1100, CastleDoorObject);
        
        sprite_index = FrankensteinSendOutBrains;
        
        audio_play_sound(ScorpionBrainDrop, 15, false);
        brain_inst = instance_create_depth(1800, 1000, -1800, ScorpionBrainObject);
        with (brain_inst)
        {
            path_start(path8, 5, path_action_continue, false);
        }
        
        global.number_of_brains_on_screen++;
        if (global.easy_difficulty)
        {
            myTimer = room_speed*50;
        }
        else if (global.medium_difficulty)
        {
            myTimer = room_speed*40;
            
        }
        else if (global.hard_difficulty)
        {
            myTimer = room_speed*30;
        }
        else if (global.doom_difficulty)
        {
            myTimer = room_speed*13;
        }
    
        
        x += 100

    }


    //LEVEL 2 - BigBrain

    myTimer--;
    door_myTimer--;

    if (global.number_of_brains_on_screen <= global.max_number_of_brains && global.current_level ==2 && myTimer <= 0 && !global.petrification && !global.freeze_brains && !global.terror)
    {
        random_y = irandom_range(400, 922);
        
        show_debug_message("In current level 2");
        
        door = instance_create_depth(2000, 1200, -1100, CastleDoorObject);
        
        
        sprite_index = FrankensteinSendOutBrains;
    
        x += 100;
        
    
        
        audio_play_sound(BigBrainDropSound, 10, false);
        brain_inst = instance_create_depth(1800, 1000, -1800, BigBrainObject);
        with (brain_inst)
        {
            path_start(path8, 5, path_action_continue, false);
        }
        
        global.number_of_brains_on_screen++;
        if (global.easy_difficulty)
        {
            myTimer = room_speed*50;
        }
        else if (global.medium_difficulty)
        {
            myTimer = room_speed*40;
            
        }
        else if (global.hard_difficulty)
        {
            myTimer = room_speed*30;
        }
        else if (global.doom_difficulty)
        {
            myTimer = room_speed*13;
        }
    
        
        

    }
    
    /////LEVEL 1 - Simple Brain
    
    if (global.number_of_brains_on_screen <= global.max_number_of_brains && global.current_level == 1 && myTimer <= 0 && !global.petrification && !global.freeze_brains && !global.terror)
    {
                random_y = irandom_range(400, 922);
        
        show_debug_message("In current level 2");
        
        door = instance_create_depth(2000, 1200, -1100, CastleDoorObject);
        
        global.frank_myTimer--;
        
        
            
            
        sprite_index = FrankensteinSendOutBrains;
    
            x += 100
        
        
        audio_play_sound(SimpleBrainSpawn, 10, false);
        brain_inst = instance_create_depth(1800, 1000, -1800, SimpleBrain);
        with (brain_inst)
        {
            path_start(path8, 5, path_action_continue, false);
        }
            

        

        
        global.number_of_brains_on_screen++;
        if (global.easy_difficulty)
        {
            myTimer = room_speed*50;
        }
        else if (global.medium_difficulty)
        {
            myTimer = room_speed*40;
            
        }
        else if (global.hard_difficulty)
        {
            myTimer = room_speed*30;
        }
        else if (global.doom_difficulty)
        {
            myTimer = room_speed*13;
        }
    
        
        

    }



///////////////STAGES////////////////////








//////////////FRANKENSTEIN AUDIO/////////////////////

    //audio
    frank_audio_myTimer--;
    
    if (frank_audio_myTimer <= 0)
    {
        audio_play_sound(FrankensteinsLaugh, 15, false);   
        frank_audio_myTimer = room_speed*15;
        
    }
    
    
    //frankenstein's monster
    
    f_myTimer--;
    
    if (f_myTimer <= 0)
    {
    

        with (FrankensteinIdleObject)
        {
            instance_destroy();
        }

        if (!instance_exists(FrankMonsterObject))
        {
            
            instance_create_depth(x, y-400, -15500, FrankMonsterObject);
            f_flag = true;
            g_myTimer = room_speed*2;
            
        }
        
    }
    
    
    if (f_flag == true)
    {
        g_myTimer--;
            
        if (g_myTimer <= 0)
        {
            f_myTimer = room_speed*50; //was 200
            f_flag = false;
        
            instance_create_depth(2100, 700, -1000, FrankensteinIdleObject);
        }
    }
    
    
    myTimer--;
}
///////
 
OK. Rehash.
Can someone take a look at this? The controller "BrainMaster" above spawns evil brains in the main room. They spawn, la la la, then go into another room, the alchemist room, I return to main room and it stops spawning. If there were brains there before they still are there in the same
spot but no new brains are made.
 
Top