Instance Deactivation and Views



Hello everyone.
I'm having problems in regards of instance activation/deactivation.

Back in GM8, I've always done this.

I have an instance called "camera" which, in the step event, controls the enemy activation/deactivation.
obj_deactivateme is the parent of object for all enemies (it's actually the parent of the enemies' parents), but it still works.

For some reason, in GMS2 this doesn't seem to work.
The instances are indeed deactivated, but are not reactivated once they step into the activation region.
Moreover, the instances that are created already in the region are not deactivated once they step out of it.
I've checked my original GM8 files and all seems to work correctly.

Other than that, I've also noticed, by adjusting the x offset of the view juuust a bit (in the room editor), the game acts as if the view doesn't move. The "camera" does, but the activation region doesn't follow the view, but instead remains to the starting coordinates of the view.

So... what is happening?


First of all, your way of doing this is taxing more than it should.
And I think it doesn't work to activate/deactivate in the same step anymore.
What you should do is the following:

- Your parent could have an "outside view" event with the deactivation code inside.
- Your camera object or whatever object the cam follows could activate a region (probably the view size and position) each 2 or 4 steps. (maybe even more if your game doesn't scroll too fast)


I actually just solved it.

Back in GM8, I just used view_xview[0] etc.
Whereas in GMS2 things changed:

var view_wview = camera_get_view_width(view_camera[0]);
var view_hview = camera_get_view_height(view_camera[0]);
var view_xview = camera_get_view_x(view_camera[0);
var view_yview = camera_get_view_y(view_camera[0]);/quote]