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

HTML 5 Depth

Ziberteck

Member
So I've been noticing that there is an issue with depth in game maker html5 edition what doesn't exist in the windows version. To reduce lag, as one should, i have a script that limits the objects that are active on the screen.
Code:
// code ran through the step event of a persistent controller object.
//activate instances
        instance_activate_all();
        
        //de-activate anything outside of the view
        instance_deactivate_region(view_xview[0]-64,view_yview[0]-64,view_wview[0]+64,view_hview[0]+64,false,true);
        
        //keep activated
        instance_activate_object(obj_wall);
        instance_activate_object(obj_wall_threw);
        //instance_deactivate_region(view_xview[0]-384,view_yview[0]-384,view_wview[0]+384,view_hview[0]+384,false,true);
        instance_activate_object(obj_player);
However in the html version when objects are loaded again when approached their depth is all over the place.
Code:
//work around code.
var temp = depth;
depth = 1;
depth = round(temp);
I can fix it if I add this code to every step event of the objects that are activated, but that is a rather taxing way work around at this point(with as many various objects i have that are effected). The obvious solution seemed to be to run this code using an with(all) statement but that seems to break their functionality(which i can't even begin to figure out why that is). This project wasn't initially going to have an html5 version, so it wasn't optimized for that platform, but i'm at a loss as to how to fix this atm. Any and all help would be appreciated.
 
J

jc-drile77

Guest
Yep, happens to me too...
Your fix works, but an official woraround (fix) would be appreciated. :)
 
Top