• 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!

Legacy GM My doors won't work :P

B

BlackyyGMS

Guest
So hello guys, I have a problem with my "doors" not working, I've been trying to fix that for a couple of days but it still doesnt work. I have 4 object, 2 types of objects, 3 rooms I want to move freely between.

(My exits don't have any codes according to the video by RickyG here >
)

Both my Exits and Doors are invisible, are NOT solid, are NOT persistent and do NOT use physics

The codes for my doors are

Creation:
Code:
// whichroom > room you want to go
// whichexit > spawn point in the room

var whichroom
whichexit = 1;

// whichexit 0 = a
// whichexit 1 = b
// whichexit 2 = c
Collision with player (obj_chara):
Code:
room_goto(whichroom);
and the second action for collision with the player (obj_chara)
Code:
if instance_exists(obj_setroom.object){

if whichexit = 0{
obj_setroom.a = 1;
obj_setroom.b = 0;
obj_setroom.c = 0;
}
else
{
if whichexit = 1{
obj_setroom.a = 0;
obj_setroom.b = 1;
obj_setroom.c = 0;
}
else
{
if whichexit = 2{
obj_setroom.a = 0;
obj_setroom.b = 0;
obj_setroom.c = 1;
}
}
}

}
else
{
// do nothing (for error handling)
}
Creation of obj_setroom
Code:
// exits
a=1;
b=2;
c=2;
Room start (obj_setroom)
Code:
if instance_exists(obj_chara){
if inb = 1{

obj_chara.x = bx;
obj_chara.y = by;

inb = 0;

}
else
{
if ins = 1{

obj_chara.x = bx;
obj_chara.y = by;

ins = 0;

}
}
}
and here are my rooms with obj_door creation codes and exits

room_water_shop
Code:
whichroom = room_precorridor;
whichexit = 1;
(exit b)


room_precorridor
Code:
whichroom = room_water_shop;
whichexit = 1;
(exit b)
Code:
whichroom = room_fake_hallway_true;
whichexit = 2;
(exit c)

room_fake_hallway_true
Code:
whichroom = room_precorridor;
whichexit = 2;
(exit c)

And, the problem is that I phase through these doors, I have no error message and obj_chara doesn't teleport or anything

Tell me if you need more information or something
 
Last edited by a moderator:
P

PandaPenguin

Guest
is your obj_chara persistent? because I can see no instance_create(bx, by, obj_chara) anywhere in your events

you are checking for its existence in the room_start event but you do nothing if it doesn't exist

also using [ CODE] and [ /CODE] around your inserted code would make it easier for us to read it here
 
B

BlackyyGMS

Guest
is your obj_chara persistent? because I can see no instance_create(bx, by, obj_chara) anywhere in your events

you are checking for its existence in the room_start event but you do nothing if it doesn't exist

also using [ CODE] and [ /CODE] around your inserted code would make it easier for us to read it here
Yes, obj_chara is Persistent, I tried also making it not persistent but the results are the same
 
Top