F
foxroar1
Guest
Hi everyone,
I'm using the latest version of GMS2.
I'm creating a Mario game and I'm trying to deactivate everything outside of the camera view.
The room has viewport 0 enabled and visible with the camera properties width of 400 and height of 300. It's following my obj_p1, with a horizontal border of 200, vertical border of 150.
The obj_controller is following obj_p1 exactly.
CREATE EVENT
STEP EVENT
ALARM 0 EVENT
It should be only activating objects within the view. I've checked the left border and it works correctly, but the right border doesn't deactivate objects immediately outside the view. Goombas still come towards me even if they're off screen. I've tried absolutely everything I can think of. I've tried inputting the actual view width of 400, I've changed it to 350 but it's never exact to where I think it should be activating/deactiving objects.
I've also tried putting all this code in obj_p1, or using an obj_p1 or the controllers exact x/y location but it never works.
I appreciate the help,
-foxroar1
I'm using the latest version of GMS2.
I'm creating a Mario game and I'm trying to deactivate everything outside of the camera view.
The room has viewport 0 enabled and visible with the camera properties width of 400 and height of 300. It's following my obj_p1, with a horizontal border of 200, vertical border of 150.
The obj_controller is following obj_p1 exactly.
CREATE EVENT
Code:
vx = camera_get_view_x(view_camera[0]); //camera x
vy = camera_get_view_y(view_camera[0]); //camera y
vw = camera_get_view_width(view_camera[0]); //camera width
vh = camera_get_view_height(view_camera[0]); //camera height
alarm[0]=1; //activate area
Code:
vx = camera_get_view_x(view_camera[0]); //camera x
vy = camera_get_view_y(view_camera[0]); //camera y
vw = camera_get_view_width(view_camera[0]); //camera width
vh = camera_get_view_height(view_camera[0]); //camera height
if (instance_exists(obj_p1))
{
x=obj_p1.x;
y=obj_p1.y;
}
Code:
instance_deactivate_all(true); //deactivate all
instance_activate_region(vx,vy,vx+vw,vy+vh,true);
alarm[0]=5;
I've also tried putting all this code in obj_p1, or using an obj_p1 or the controllers exact x/y location but it never works.
I appreciate the help,
-foxroar1