CommitLog |

This commit is contained in:
SilicaAndPina 2020-07-24 13:48:09 +12:00
parent 10ab496e57
commit c964df8a67
5 changed files with 75 additions and 18 deletions

View file

@ -16,24 +16,28 @@
<sprite>sprites\spr_enemy</sprite> <sprite>sprites\spr_enemy</sprite>
<sprite>sprites\spr_asteroid</sprite> <sprite>sprites\spr_asteroid</sprite>
<sprite>sprites\spr_boom</sprite> <sprite>sprites\spr_boom</sprite>
<sprite>sprites\spr_chunk</sprite>
</sprites> </sprites>
<backgrounds name="background"> <backgrounds name="background">
<background>background\bg_space</background> <background>background\bg_space</background>
</backgrounds> </backgrounds>
<paths name="paths"/> <paths name="paths"/>
<scripts name="scripts"> <scripts name="scripts"/>
<script>scripts\load_chunk.gml</script>
</scripts>
<objects name="objects"> <objects name="objects">
<object>objects\obj_player</object> <object>objects\obj_player</object>
<object>objects\obj_controller_world_gen</object> <object>objects\obj_controller_world_gen</object>
<object>objects\obj_controller</object> <object>objects\obj_controller</object>
<object>objects\obj_bullet</object> <object>objects\obj_bullet</object>
<object>objects\obj_asteriod</object> <object>objects\obj_asteriod</object>
<object>objects\obj_chunk</object>
</objects> </objects>
<rooms name="rooms"> <rooms name="rooms">
<room>rooms\rm_game</room> <room>rooms\rm_game</room>
</rooms> </rooms>
<constants number="2">
<constant name="TILE_SIZE">32</constant>
<constant name="CHUNK_SIZE">16</constant>
</constants>
<help> <help>
<rtf>help.rtf</rtf> <rtf>help.rtf</rtf>
</help> </help>

View file

@ -74,17 +74,43 @@ step_counter++;
<kind>1</kind> <kind>1</kind>
<string>/// Draw Debug Screen <string>/// Draw Debug Screen
var chunkRelX = obj_player.x % (CHUNK_SIZE*TILE_SIZE); var chunk_total_size = (CHUNK_SIZE*TILE_SIZE);
var chunkRelY = obj_player.y % (CHUNK_SIZE*TILE_SIZE)
var chunkX = (obj_player.x - chunkRelX) / (CHUNK_SIZE*TILE_SIZE); var playX = obj_player.x;
var chunkY = (obj_player.y - chunkRelY) / (CHUNK_SIZE*TILE_SIZE); var playY = obj_player.y;
var chunkRelX = obj_player.x % chunk_total_size;
var chunkRelY = obj_player.y % chunk_total_size;
var chunkX = (obj_player.x - chunkRelX) / chunk_total_size;
var chunkY = (obj_player.y - chunkRelY) / chunk_total_size;
if(chunkX &lt; 0)
{
chunkX -= 1;
}
if(chunkY &lt; 0)
{
chunkY -= 1;
}
if(chunkY == 0 &amp;&amp; (playY &lt; 0 &amp;&amp; playY &gt;= chunk_total_size/-1))
{
chunkY = -1;
}
if(chunkX == 0 &amp;&amp; (playX &lt; 0 &amp;&amp; playX &gt;= chunk_total_size/-1))
{
chunkX = -1;
}
draw_text(10,10,"X: "+string(obj_player.x)+"#Y: "+string(obj_player.y)); draw_text(10,10,"X: "+string(obj_player.x)+"#Y: "+string(obj_player.y));
draw_text(10,40,"CrX: "+string(chunkRelX)+"#CrY: "+string(chunkRelY)); draw_text(10,40,"CrX: "+string(chunkRelX)+"#CrY: "+string(chunkRelY));
draw_text(10,70,"CX: "+string(chunkX)+"#CY: "+string(chunkY)); draw_text(10,70,"CX: "+string(chunkX)+"#CY: "+string(chunkY));
</string> </string>
</argument> </argument>
</arguments> </arguments>

View file

@ -50,15 +50,42 @@
<arguments> <arguments>
<argument> <argument>
<kind>1</kind> <kind>1</kind>
<string>var chunkRelX = obj_player.x % (CHUNK_SIZE*TILE_SIZE); <string>var playX = obj_player.x;
var chunkRelY = obj_player.y % (CHUNK_SIZE*TILE_SIZE) var playY = obj_player.y;
var chunkX = (obj_player.x - chunkRelX) / (CHUNK_SIZE*TILE_SIZE); var chunk_total_size = (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)) var chunkRelX = playX % chunk_total_size;
var chunkRelY = playY % chunk_total_size;
var chunkX = (obj_player.x - chunkRelX);
var chunkY = (obj_player.y - chunkRelY);
if(chunkX &lt; 0)
{ {
instance_create(chunkX*(CHUNK_SIZE*TILE_SIZE),chunkY*(CHUNK_SIZE*TILE_SIZE),obj_chunk); chunkX -= chunk_total_size;
}
if(chunkY &lt; 0)
{
chunkY -= chunk_total_size;
}
if(chunkY == 0 &amp;&amp; (playY &lt; 0 &amp;&amp; playY &gt;= chunk_total_size/-1) )
{
chunkY = chunk_total_size/-1;
}
if(chunkX == 0 &amp;&amp; (playX &lt; 0 &amp;&amp; playX &gt;= chunk_total_size/-1) )
{
chunkX = chunk_total_size/-1;
}
if(!place_meeting(chunkX, chunkY,obj_chunk))
{
instance_create(chunkX,chunkY,obj_chunk);
} }
</string> </string>
</argument> </argument>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -6,11 +6,11 @@
<colkind>1</colkind> <colkind>1</colkind>
<coltolerance>0</coltolerance> <coltolerance>0</coltolerance>
<sepmasks>0</sepmasks> <sepmasks>0</sepmasks>
<bboxmode>0</bboxmode> <bboxmode>1</bboxmode>
<bbox_left>511</bbox_left> <bbox_left>0</bbox_left>
<bbox_right>0</bbox_right> <bbox_right>511</bbox_right>
<bbox_top>511</bbox_top> <bbox_top>0</bbox_top>
<bbox_bottom>0</bbox_bottom> <bbox_bottom>511</bbox_bottom>
<HTile>0</HTile> <HTile>0</HTile>
<VTile>0</VTile> <VTile>0</VTile>
<TextureGroups> <TextureGroups>