Turkish Coffee
Member
Hey,
I'm creating a world with these codes and I ask for optimization tips as its my first time creating & handling a huge procedural room. And I'd like to know how I should approach "creating parallax moving backgrounds using oBiomeObjects"
Step event of oGame (deleted some unneeded codes)
and in the oBiomeObject Draw Event
I'm creating a world with these codes and I ask for optimization tips as its my first time creating & handling a huge procedural room. And I'd like to know how I should approach "creating parallax moving backgrounds using oBiomeObjects"
Step event of oGame (deleted some unneeded codes)
Code:
///Build The Game World
iother = instance_number(oBiomeObject);
// WHILE
if (GroundisReady == 0) {
instance_create(addX,160+worldmover,oGroundTile);
addX += 48;
}
if (GrassisReady == 0)
{
instance_create(addXg,167+60,oGrass1);
addXg += 32;
}
if (GroundisReady == 1)
{
if (BiomesAreReady == 0)
{
var inst = instance_create(addXBiome,166+60,oBiomeObject);
inst.i = iother+15;
iother++;
addXBiome += 256;
}
if (TownisReady == 0)
{
instance_create(room_width/2,166+worldmover,oTownCenter);
instance_create(room_width/2,166+worldmover,oCampfire);
TownisReady = 1;
}
}
if (TownisReady == 1 && StartingPeopleReady == 0 && GrassisReady == 1)
{
//Creating people here
StartingPeopleReady = 1;
} else if (view_yview[0] != 60)
{
view_yview[0] = 60;
} else if (view_yview[0] == 60 && whiten == false)
{
global.game = "running";
}
Code:
if (backgroundID != noone) //backgroundID determined in step event thats randomly chosen from the Create Event
{
if !(tile_exists(backgroundID))
{
if (backgroundID == sStoneBoulder2)
{
draw_sprite(backgroundID,0,x,y );
}
if (backgroundID == sRocks1)
{
draw_sprite(backgroundID,0,x,y ); //I've been drawing them with tile_add(); before
}
}
}