CommitLog |

This commit is contained in:
SilicaAndPina 2020-07-24 11:19:56 +12:00
parent a9c35b6d6c
commit 10ab496e57
6 changed files with 60 additions and 59 deletions

View File

@ -0,0 +1,23 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>spr_chunk</spriteName>
<solid>0</solid>
<visible>-1</visible>
<depth>0</depth>
<persistent>0</persistent>
<parentName>&lt;undefined&gt;</parentName>
<maskName>&lt;undefined&gt;</maskName>
<events/>
<PhysicsObject>0</PhysicsObject>
<PhysicsObjectSensor>0</PhysicsObjectSensor>
<PhysicsObjectShape>0</PhysicsObjectShape>
<PhysicsObjectDensity>0.5</PhysicsObjectDensity>
<PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
<PhysicsObjectGroup>0</PhysicsObjectGroup>
<PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
<PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
<PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
<PhysicsObjectAwake>-1</PhysicsObjectAwake>
<PhysicsObjectKinematic>0</PhysicsObjectKinematic>
<PhysicsShapePoints/>
</object>

View File

@ -74,11 +74,11 @@ step_counter++;
<kind>1</kind>
<string>/// Draw Debug Screen
var chunkRelX = obj_player.x % 256
var chunkRelY = obj_player.y % 256
var chunkRelX = obj_player.x % (CHUNK_SIZE*TILE_SIZE);
var chunkRelY = obj_player.y % (CHUNK_SIZE*TILE_SIZE)
var chunkX = (obj_player.x - chunkRelX) / 256,;
var chunkY = (obj_player.y - chunkRelY) / 256;
var chunkX = (obj_player.x - chunkRelX) / (CHUNK_SIZE*TILE_SIZE);
var chunkY = (obj_player.y - chunkRelY) / (CHUNK_SIZE*TILE_SIZE);

View File

@ -50,15 +50,16 @@
<arguments>
<argument>
<kind>1</kind>
<string>var chunkRelX = obj_player.x % 256
var chunkRelY = obj_player.y % 256
<string>var chunkRelX = obj_player.x % (CHUNK_SIZE*TILE_SIZE);
var chunkRelY = obj_player.y % (CHUNK_SIZE*TILE_SIZE)
var chunkX = (obj_player.x - chunkRelX) / 256,;
var chunkY = (obj_player.y - chunkRelY) / 256;
if(loaded_chunks[0] == 0)
loaded_chunks[0] = load_chunk(chunkX,chunkY);
var chunkX = (obj_player.x - chunkRelX) / (CHUNK_SIZE*TILE_SIZE);
var chunkY = (obj_player.y - chunkRelY) / (CHUNK_SIZE*TILE_SIZE) - 1;
if(!place_meeting(chunkX*(CHUNK_SIZE*TILE_SIZE), chunkY*(CHUNK_SIZE*TILE_SIZE),obj_chunk))
{
instance_create(chunkX*(CHUNK_SIZE*TILE_SIZE),chunkY*(CHUNK_SIZE*TILE_SIZE),obj_chunk);
}
</string>
</argument>
</arguments>

View File

@ -1,48 +0,0 @@
///load_chunk(cx,cy);
var cx = argument0
var cy = argument1
var chunk_grid = ds_grid_create(256,256);
var filename = string(cx)+","+string(cy)+".spr";
if(file_exists(filename)) // Load Chunk
{
ini_open(filename);
for(var xx = 0; xx < 256; xx++)
{
for(var yy = 0; yy < 256; yy++)
{
var nm = string(xx)+string(yy);
var c = ini_read_real("XYV",nm,0);
chunk_grid[xx,yy] = c;
if(c != 0)
instance_create(xx,yy,c);
}
}
ini_close();
}
else // Generate Chunk
{
ini_open(filename);
for(var xx = 0; xx < 256; xx++)
{
for(var yy = 0; yy < 256; yy++)
{
var nm = string(xx)+string(yy);
if(random_range(0,10) > 5)
{
ini_write_real("XYV",nm,obj_asteriod);
chunk_grid[xx,yy] = obj_asteriod;
instance_create(cx+xx,cy+yy,obj_asteriod);
}
else
{
ini_write_real("XYV",nm,0);;
chunk_grid[xx,yy] = 0;
}
}
}
ini_close();
}
return chunk_grid;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,25 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<sprite>
<type>0</type>
<xorig>0</xorig>
<yorigin>0</yorigin>
<colkind>1</colkind>
<coltolerance>0</coltolerance>
<sepmasks>0</sepmasks>
<bboxmode>0</bboxmode>
<bbox_left>511</bbox_left>
<bbox_right>0</bbox_right>
<bbox_top>511</bbox_top>
<bbox_bottom>0</bbox_bottom>
<HTile>0</HTile>
<VTile>0</VTile>
<TextureGroups>
<TextureGroup0>0</TextureGroup0>
</TextureGroups>
<For3D>0</For3D>
<width>512</width>
<height>512</height>
<frames>
<frame index="0">images\spr_chunk_0.png</frame>
</frames>
</sprite>