A
atrus159
Guest
Yesterday I added code for doors to transition between rooms. To test the doors I set up a series of 4 rooms with doors between them. The doors all have a room and a door object that they go to, as well as a script for how to arrange the characters upon exiting the door (you control several characters from top down view). Upon clicking on the door, if a character is sufficiently close, it will tell the control object the door that it goes to and then transition to the appropriate room. On room start the control object will check if it has been told a door to go to, and if it does, it will find that door and call its script to arrange all the characters next to it.
This works as intended, except that sometimes on going from one room to another the game will freeze and will need to be force quit. The screen stays black from the fade transition so I assume it freezes before a draw event ever happens. These freezes happen seemingly at random (I have had them on every door, and have also had every door work at some point). I've had it happen as soon as the first door and as late as five minutes after starting the game. I have been completely unable to reliably reproduce this other than by rapidly going back and for through doors for several minutes.
relevant code:
object Door left release event:
object room_fade draw gui event
object control room start event
One of the door placement scripts. There are 4 right now, one for each direction of door and they are identical the same except for placement directions
This works as intended, except that sometimes on going from one room to another the game will freeze and will need to be force quit. The screen stays black from the fade transition so I assume it freezes before a draw event ever happens. These freezes happen seemingly at random (I have had them on every door, and have also had every door work at some point). I've had it happen as soon as the first door and as late as five minutes after starting the game. I have been completely unable to reliably reproduce this other than by rapidly going back and for through doors for several minutes.
relevant code:
object Door left release event:
Code:
if(clicked_on && !control.paused){
clicked_on = 0;
if(distance_to_object(instance_nearest(x,y,pc_character))<=64){
if(!blocked){
control.door_out = door_out;
var myFade = instance_create_layer(0,0,"GUI",room_fade);
myFade.toGo = room_to;
}
}
}
Code:
if(t<(tMax+10)){
t++
}else{
control.paused = 0;
mouse.fixed_camera = 0;
instance_destroy(self);
room_goto(toGo);
}
draw_set_alpha(t/tMax);
draw_set_color(c_black);
draw_rectangle(0,0,window_get_width(),window_get_height(),false);
draw_set_alpha(1);
Code:
if(door_out != noone){
with(door){
if(object_index == other.door_out){
script_execute(placement);
}
}
door_out = noone
}
Code:
camera_set_view_size(mouse.myCamera,640,480);
camera_set_view_pos(mouse.myCamera, x-100,y-150);
var offset = 0;
with(pc_character){
direction = 0;
x = other.x +64;
y = other.y +65*offset;
if(offset<=0){
offset *= -1;
offset +=1;
}else{
offset *=-1;
}
}