CommitLog |
This commit is contained in:
parent
10ab496e57
commit
c964df8a67
5 changed files with 75 additions and 18 deletions
|
@ -16,24 +16,28 @@
|
|||
<sprite>sprites\spr_enemy</sprite>
|
||||
<sprite>sprites\spr_asteroid</sprite>
|
||||
<sprite>sprites\spr_boom</sprite>
|
||||
<sprite>sprites\spr_chunk</sprite>
|
||||
</sprites>
|
||||
<backgrounds name="background">
|
||||
<background>background\bg_space</background>
|
||||
</backgrounds>
|
||||
<paths name="paths"/>
|
||||
<scripts name="scripts">
|
||||
<script>scripts\load_chunk.gml</script>
|
||||
</scripts>
|
||||
<scripts name="scripts"/>
|
||||
<objects name="objects">
|
||||
<object>objects\obj_player</object>
|
||||
<object>objects\obj_controller_world_gen</object>
|
||||
<object>objects\obj_controller</object>
|
||||
<object>objects\obj_bullet</object>
|
||||
<object>objects\obj_asteriod</object>
|
||||
<object>objects\obj_chunk</object>
|
||||
</objects>
|
||||
<rooms name="rooms">
|
||||
<room>rooms\rm_game</room>
|
||||
</rooms>
|
||||
<constants number="2">
|
||||
<constant name="TILE_SIZE">32</constant>
|
||||
<constant name="CHUNK_SIZE">16</constant>
|
||||
</constants>
|
||||
<help>
|
||||
<rtf>help.rtf</rtf>
|
||||
</help>
|
||||
|
|
|
@ -74,17 +74,43 @@ step_counter++;
|
|||
<kind>1</kind>
|
||||
<string>/// Draw Debug Screen
|
||||
|
||||
var chunkRelX = obj_player.x % (CHUNK_SIZE*TILE_SIZE);
|
||||
var chunkRelY = obj_player.y % (CHUNK_SIZE*TILE_SIZE)
|
||||
var chunk_total_size = (CHUNK_SIZE*TILE_SIZE);
|
||||
|
||||
var chunkX = (obj_player.x - chunkRelX) / (CHUNK_SIZE*TILE_SIZE);
|
||||
var chunkY = (obj_player.y - chunkRelY) / (CHUNK_SIZE*TILE_SIZE);
|
||||
var playX = obj_player.x;
|
||||
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 < 0)
|
||||
{
|
||||
chunkX -= 1;
|
||||
}
|
||||
|
||||
if(chunkY < 0)
|
||||
{
|
||||
chunkY -= 1;
|
||||
}
|
||||
|
||||
if(chunkY == 0 && (playY < 0 && playY >= chunk_total_size/-1))
|
||||
{
|
||||
chunkY = -1;
|
||||
}
|
||||
|
||||
if(chunkX == 0 && (playX < 0 && playX >= chunk_total_size/-1))
|
||||
{
|
||||
chunkX = -1;
|
||||
}
|
||||
|
||||
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,70,"CX: "+string(chunkX)+"#CY: "+string(chunkY));
|
||||
|
||||
</string>
|
||||
</argument>
|
||||
</arguments>
|
||||
|
|
|
@ -50,15 +50,42 @@
|
|||
<arguments>
|
||||
<argument>
|
||||
<kind>1</kind>
|
||||
<string>var chunkRelX = obj_player.x % (CHUNK_SIZE*TILE_SIZE);
|
||||
var chunkRelY = obj_player.y % (CHUNK_SIZE*TILE_SIZE)
|
||||
<string>var playX = obj_player.x;
|
||||
var playY = obj_player.y;
|
||||
|
||||
var chunkX = (obj_player.x - chunkRelX) / (CHUNK_SIZE*TILE_SIZE);
|
||||
var chunkY = (obj_player.y - chunkRelY) / (CHUNK_SIZE*TILE_SIZE) - 1;
|
||||
var chunk_total_size = (CHUNK_SIZE*TILE_SIZE);
|
||||
|
||||
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 < 0)
|
||||
{
|
||||
instance_create(chunkX*(CHUNK_SIZE*TILE_SIZE),chunkY*(CHUNK_SIZE*TILE_SIZE),obj_chunk);
|
||||
chunkX -= chunk_total_size;
|
||||
}
|
||||
|
||||
if(chunkY < 0)
|
||||
{
|
||||
chunkY -= chunk_total_size;
|
||||
}
|
||||
|
||||
if(chunkY == 0 && (playY < 0 && playY >= chunk_total_size/-1) )
|
||||
{
|
||||
chunkY = chunk_total_size/-1;
|
||||
}
|
||||
|
||||
if(chunkX == 0 && (playX < 0 && playX >= chunk_total_size/-1) )
|
||||
{
|
||||
chunkX = chunk_total_size/-1;
|
||||
}
|
||||
|
||||
|
||||
if(!place_meeting(chunkX, chunkY,obj_chunk))
|
||||
{
|
||||
instance_create(chunkX,chunkY,obj_chunk);
|
||||
}
|
||||
</string>
|
||||
</argument>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 3.7 KiB |
|
@ -6,11 +6,11 @@
|
|||
<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>
|
||||
<bboxmode>1</bboxmode>
|
||||
<bbox_left>0</bbox_left>
|
||||
<bbox_right>511</bbox_right>
|
||||
<bbox_top>0</bbox_top>
|
||||
<bbox_bottom>511</bbox_bottom>
|
||||
<HTile>0</HTile>
|
||||
<VTile>0</VTile>
|
||||
<TextureGroups>
|
||||
|
|
Reference in a new issue