CommitLog |

This commit is contained in:
SilicaAndPina 2020-07-25 19:47:36 +12:00
parent 29110d6a69
commit 71f77f2ae9
9 changed files with 166 additions and 29 deletions

Binary file not shown.

View File

@ -28,8 +28,10 @@
</backgrounds>
<paths name="paths"/>
<scripts name="scripts">
<script>scripts\get_chunk_coords.gml</script>
<script>scripts\damage_player.gml</script>
<script>scripts\save_game_data.gml</script>
<script>scripts\pull_towards_black_holes.gml</script>
</scripts>
<objects name="objects">
<objects name="natural generation">

View File

@ -59,6 +59,33 @@ if(speed &gt; 0)
{
speed -= 1
}
pull_towards_black_holes();
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="obj_black_hole">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>instance_create(x,y,obj_boom_fx)
instance_destroy(id);
</string>
</argument>
</arguments>

View File

@ -50,6 +50,7 @@
<argument>
<kind>1</kind>
<string>image_angle += 1;
</string>
</argument>
</arguments>

View File

@ -35,9 +35,9 @@ for(var xx = 0; xx &lt; CHUNK_SIZE*TILE_SIZE; xx+= TILE_SIZE)
{
for(var yy = 0; yy &lt; CHUNK_SIZE*TILE_SIZE; yy+= TILE_SIZE)
{
var rnd = random_range(0,1000);
var rnd = random_range(0,5000);
if(floor(rnd) == 500)
if(floor(rnd) == 1000)
{
if(hasGeneratedBlackHole)
continue;

View File

@ -94,37 +94,13 @@ for(var i = 0; i &lt; 16; i ++)
<kind>1</kind>
<string>/// Load Chunks
var playX = obj_player.x;
var playY = obj_player.y;
var chunk_total_size = (CHUNK_SIZE*TILE_SIZE);
var chunkCoords = get_chunk_coords(obj_player.x,obj_player.y);
var chunkRelX = playX % chunk_total_size;
var chunkRelY = playY % chunk_total_size;
var chunkX = chunkCoords[0];
var chunkY = chunkCoords[1];
var chunkX = (obj_player.x - chunkRelX);
var chunkY = (obj_player.y - chunkRelY);
// Fix annoyances where % negative = positive
if(chunkX &lt; 0)
{
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;
}
chunkX -= chunk_total_size;
chunkY -= chunk_total_size;
// Load Chunks

View File

@ -80,6 +80,7 @@ if(hp &lt;= 0)
}
direction = image_angle
speed = floor(speed);
if(speed &lt; 0)
{
@ -133,6 +134,51 @@ if(invuln_counter != invuln_counter_max)
}
</string>
</argument>
</arguments>
</action>
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>///pull_towards_black_holes();
pull_towards_black_holes();
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="obj_black_hole">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>damage_player(hp_max);
</string>
</argument>
</arguments>

View File

@ -0,0 +1,42 @@
///get_chunk_coords(x,y)
var xx = argument0;
var yy = argument1;
var chunk_total_size = (CHUNK_SIZE*TILE_SIZE);
var playX = xx;
var playY = yy;
var chunkRelX = playX % chunk_total_size;
var chunkRelY = playY % chunk_total_size;
var chunkX = (playX - chunkRelX);
var chunkY = (playY - chunkRelY);
// Fix annoyances where % negative = positive
if(chunkX < 0)
{
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;
}
var coords = array_create(1);
coords[0] = chunkX;
coords[1] = chunkY;
return coords;

View File

@ -0,0 +1,43 @@
///pull_towards_black_holes();
var distance = 0;
with(id)
{
distance = distance_to_object(obj_black_hole);
if(distance < 250)
{
var blackInstance = instance_nearest(x,y,obj_black_hole);
var blackHoleX = blackInstance.x;
var blackHoleY = blackInstance.y;
// Determine amount of gravity
var blackHoleStrength = 1.0;
if(distance > 200)
{
blackHoleStrength = 1.0;
}
if(distance > 150)
{
blackHoleStrength = 2.0;
}
else if(distance > 100)
{
blackHoleStrength = 3.0;
}
else if(distance < 50)
{
blackHoleStrength = 4.0;
}
gravity_direction = point_direction(x,y,blackHoleX, blackHoleY);
gravity = blackHoleStrength;
}
else
{
gravity = 0;
gravity_direction = 0;
}
}