diff --git a/Spaceinator.gmx.7z b/Spaceinator.gmx.7z deleted file mode 100644 index 5635dd1..0000000 Binary files a/Spaceinator.gmx.7z and /dev/null differ diff --git a/Spaceinator.project.gmx b/Spaceinator.project.gmx index 146105d..a671604 100644 --- a/Spaceinator.project.gmx +++ b/Spaceinator.project.gmx @@ -28,8 +28,10 @@ + + diff --git a/objects/obj_asteriod.object.gmx b/objects/obj_asteriod.object.gmx index a2c945b..687959b 100644 --- a/objects/obj_asteriod.object.gmx +++ b/objects/obj_asteriod.object.gmx @@ -59,6 +59,33 @@ if(speed > 0) { speed -= 1 } + + +pull_towards_black_holes(); + + + + + + + + 1 + 603 + 7 + 0 + 0 + -1 + 2 + + + self + 0 + 0 + + + 1 + instance_create(x,y,obj_boom_fx) +instance_destroy(id); diff --git a/objects/obj_black_hole.object.gmx b/objects/obj_black_hole.object.gmx index df8792d..d02c0e4 100644 --- a/objects/obj_black_hole.object.gmx +++ b/objects/obj_black_hole.object.gmx @@ -50,6 +50,7 @@ 1 image_angle += 1; + diff --git a/objects/obj_chunk.object.gmx b/objects/obj_chunk.object.gmx index a2db25d..1ab8d4a 100644 --- a/objects/obj_chunk.object.gmx +++ b/objects/obj_chunk.object.gmx @@ -35,9 +35,9 @@ for(var xx = 0; xx < CHUNK_SIZE*TILE_SIZE; xx+= TILE_SIZE) { for(var yy = 0; yy < 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; diff --git a/objects/obj_controller_world_gen.object.gmx b/objects/obj_controller_world_gen.object.gmx index c660b06..a10ad3e 100644 --- a/objects/obj_controller_world_gen.object.gmx +++ b/objects/obj_controller_world_gen.object.gmx @@ -94,37 +94,13 @@ for(var i = 0; i < 16; i ++) 1 /// 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 < 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; -} chunkX -= chunk_total_size; chunkY -= chunk_total_size; // Load Chunks diff --git a/objects/obj_player.object.gmx b/objects/obj_player.object.gmx index 3b1d240..ec4b157 100644 --- a/objects/obj_player.object.gmx +++ b/objects/obj_player.object.gmx @@ -80,6 +80,7 @@ if(hp <= 0) } direction = image_angle +speed = floor(speed); if(speed < 0) { @@ -133,6 +134,51 @@ if(invuln_counter != invuln_counter_max) } + + + + + + 1 + 603 + 7 + 0 + 0 + -1 + 2 + + + self + 0 + 0 + + + 1 + ///pull_towards_black_holes(); +pull_towards_black_holes(); + + + + + + + + 1 + 603 + 7 + 0 + 0 + -1 + 2 + + + self + 0 + 0 + + + 1 + damage_player(hp_max); diff --git a/scripts/get_chunk_coords.gml b/scripts/get_chunk_coords.gml new file mode 100644 index 0000000..def0aad --- /dev/null +++ b/scripts/get_chunk_coords.gml @@ -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; diff --git a/scripts/pull_towards_black_holes.gml b/scripts/pull_towards_black_holes.gml new file mode 100644 index 0000000..d598cd4 --- /dev/null +++ b/scripts/pull_towards_black_holes.gml @@ -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; + } +} +