CommitLog |
This commit is contained in:
parent
9c46b090cd
commit
616cdab1b6
1 changed files with 31 additions and 17 deletions
|
@ -27,22 +27,25 @@
|
|||
<kind>1</kind>
|
||||
<string>/// GameMaker Is Stupid
|
||||
|
||||
var chunkat = instance_position(cX, cY,obj_chunk);
|
||||
for(var i = 0; i < 16; i ++)
|
||||
{
|
||||
var chunkat = instance_position(cX[i], cY[i],obj_chunk);
|
||||
if(chunkat == noone) // create
|
||||
{
|
||||
show_debug_message("Generating chunk: "+string(cX)+","+string(cY));
|
||||
instance_create(cX,cY,obj_chunk);
|
||||
show_debug_message("Generating chunk: "+string(cX[i])+","+string(cY[i]));
|
||||
instance_create(cX[i],cY[i],obj_chunk);
|
||||
}
|
||||
else // load
|
||||
{
|
||||
if(chunkat.loaded = false)
|
||||
{
|
||||
show_debug_message("Loading chunk: #"+string(chunkat)+" "+string(cX)+","+string(cY));
|
||||
show_debug_message("Loading chunk: #"+string(chunkat)+" "+string(cX[i])+","+string(cY[i]));
|
||||
with(chunkat){
|
||||
event_user(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</string>
|
||||
</argument>
|
||||
</arguments>
|
||||
|
@ -65,7 +68,7 @@ else // load
|
|||
<arguments>
|
||||
<argument>
|
||||
<kind>1</kind>
|
||||
<string>/// Load / Unload Chunks
|
||||
<string>/// Load Chunks
|
||||
|
||||
var playX = obj_player.x;
|
||||
var playY = obj_player.y;
|
||||
|
@ -77,7 +80,6 @@ var chunkRelY = playY % chunk_total_size;
|
|||
|
||||
var chunkX = (obj_player.x - chunkRelX);
|
||||
var chunkY = (obj_player.y - chunkRelY);
|
||||
|
||||
// Fix annoyances where % negative = positive
|
||||
|
||||
if(chunkX < 0)
|
||||
|
@ -99,11 +101,23 @@ if(chunkX == 0 && (playX < 0 && playX >= chunk_total_size/
|
|||
{
|
||||
chunkX = chunk_total_size/-1;
|
||||
}
|
||||
chunkX -= chunk_total_size;
|
||||
chunkY -= chunk_total_size;
|
||||
// Load Chunks
|
||||
cX[16] = 0;
|
||||
cY[16] = 0;
|
||||
var i = 0;
|
||||
for(var xx = 0; xx < 4; xx++)
|
||||
{
|
||||
for(var yy = 0; yy < 4; yy++)
|
||||
{
|
||||
instance_activate_region(chunkX+(chunk_total_size*xx),chunkY+(chunk_total_size*yy),1,1,true);
|
||||
cX[i] = chunkX+(chunk_total_size*xx)
|
||||
cY[i] = chunkY+(chunk_total_size*yy)
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
instance_activate_region(chunkX,chunkY,1,1,true);
|
||||
cX = chunkX
|
||||
cY = chunkY
|
||||
alarm[0] = 1;
|
||||
|
||||
</string>
|
||||
|
|
Reference in a new issue