Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411283 Posts in 69325 Topics- by 58380 Members - Latest Member: bob1029

March 29, 2024, 07:40:55 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)activate objects with the creation of an object [Game Maker]
Pages: [1]
Print
Author Topic: activate objects with the creation of an object [Game Maker]  (Read 727 times)
Ben23
Level 0
*



View Profile
« on: July 25, 2017, 09:27:37 PM »

i hope the question its not confusing

i have a platformer and when you are in the middle of the stage a timer is activated
and i want with the activation of that timer activate other objects that are placed in the room

but i dont know how to make this
i would apreciate any advice on what part of the manual should i look into  Tongue
Logged
LilRony
Level 0
*



View Profile WWW
« Reply #1 on: July 25, 2017, 10:22:13 PM »

I think I understand what you're saying. I'll try at a solution:

When the player's x value goes beyond the x-coordinate of the room's center, have there be a set of code like this:

if (x > room_width/2) {
    if (!alarm_set) {
        alarm[0] = 30; // or whatever time you want.
        alarm_set = true;
    }
}

the variable alarm_set should be in the player's create event, set to false at the start.
when the player crosses to the center, the code that sets alarm[0] to 30 is only called once, since suddenly alarm_set is now true, and setting alarm[0] to 30 can ONLY happen when alarm_set is false.

and when you create an event for alarm[0], have the code inside be:

    instance_activate_all();

if I understand correctly, you wanted the instances to be activated after a certain amount of time when the player gets past the middle of the stage? I hope this helps  Smiley
Logged

Creator of Lost Monkey and the Star of Hope, an adventure platformer.
Ben23
Level 0
*



View Profile
« Reply #2 on: July 25, 2017, 11:23:55 PM »

I guess i need to explain myself better
When you reach the middle of the level there's an object if you take that object the game will create a timer so when this happens i want certain objects that are already in the level like traps to be activated with the timer
So what im looking for is some kind of toggle i was thinking of having some kind of parent object so i can use it with different objects to activate
But i don't know exactly how to implement this   Smiley
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic