From 2e6e2af2460b57b7d80eb93273b9a6bbacdbca5f Mon Sep 17 00:00:00 2001 From: SilicaAndPina Date: Thu, 23 Jul 2020 10:50:27 +1200 Subject: [PATCH] CommitLog | --- Spaceinator.project.gmx | 5 ++ objects/obj_asteriod.object.gmx | 52 +++++++++++++++++++++ objects/obj_bullet.object.gmx | 30 ++++++++++++ objects/obj_controller.object.gmx | 46 ++++++++++++++++++ objects/obj_controller_world_gen.object.gmx | 49 +++++++++++++++++++ objects/obj_player.object.gmx | 1 + rooms/rm_game.room.gmx | 1 + scripts/generate_world.gml | 28 +++++++++++ 8 files changed, 212 insertions(+) create mode 100644 objects/obj_asteriod.object.gmx create mode 100644 objects/obj_controller_world_gen.object.gmx create mode 100644 scripts/generate_world.gml diff --git a/Spaceinator.project.gmx b/Spaceinator.project.gmx index a693ff4..f1a056a 100644 --- a/Spaceinator.project.gmx +++ b/Spaceinator.project.gmx @@ -20,10 +20,15 @@ background\bg_space + + + objects\obj_player + objects\obj_controller_world_gen objects\obj_controller objects\obj_bullet + objects\obj_asteriod rooms\rm_game diff --git a/objects/obj_asteriod.object.gmx b/objects/obj_asteriod.object.gmx new file mode 100644 index 0000000..5875e01 --- /dev/null +++ b/objects/obj_asteriod.object.gmx @@ -0,0 +1,52 @@ + + + spr_asteroid + 0 + -1 + 0 + 0 + <undefined> + <undefined> + + + + 1 + 603 + 7 + 0 + 0 + -1 + 2 + + + self + 0 + 0 + + + 1 + var angle = random_range(0,180); +direction = angle; +image_angle = angle; + +speed = 1; + + + + + + + + 0 + 0 + 0 + 0.5 + 0.100000001490116 + 0 + 0.100000001490116 + 0.100000001490116 + 0.200000002980232 + -1 + 0 + + diff --git a/objects/obj_bullet.object.gmx b/objects/obj_bullet.object.gmx index dffac59..bdad9cc 100644 --- a/objects/obj_bullet.object.gmx +++ b/objects/obj_bullet.object.gmx @@ -60,6 +60,36 @@ if(step_counter == 60*room_speed) + + + 1 + 203 + 0 + 0 + 0 + -1 + 1 + action_kill_object + + other + 0 + 0 + + + 1 + 203 + 0 + 0 + 0 + -1 + 1 + action_kill_object + + self + 0 + 0 + + 0 0 diff --git a/objects/obj_controller.object.gmx b/objects/obj_controller.object.gmx index dd79ffa..e2ad267 100644 --- a/objects/obj_controller.object.gmx +++ b/objects/obj_controller.object.gmx @@ -8,6 +8,52 @@ <undefined> <undefined> + + + 1 + 603 + 7 + 0 + 0 + -1 + 2 + + + self + 0 + 0 + + + 1 + step_counter = 0; + + + + + + + + 1 + 603 + 7 + 0 + 0 + -1 + 2 + + + self + 0 + 0 + + + 1 + step_counter++; + + + + + 1 diff --git a/objects/obj_controller_world_gen.object.gmx b/objects/obj_controller_world_gen.object.gmx new file mode 100644 index 0000000..bbd79d6 --- /dev/null +++ b/objects/obj_controller_world_gen.object.gmx @@ -0,0 +1,49 @@ + + + <undefined> + 0 + -1 + 0 + 0 + <undefined> + <undefined> + + + + 1 + 603 + 7 + 0 + 0 + -1 + 2 + + + self + 0 + 0 + + + 1 + generated_count = 0; +generated_areas = array_create(1000); + + + + + + + + 0 + 0 + 0 + 0.5 + 0.100000001490116 + 0 + 0.100000001490116 + 0.100000001490116 + 0.200000002980232 + -1 + 0 + + diff --git a/objects/obj_player.object.gmx b/objects/obj_player.object.gmx index f53a863..74a85e2 100644 --- a/objects/obj_player.object.gmx +++ b/objects/obj_player.object.gmx @@ -83,6 +83,7 @@ view_yview[0] = y - view_hview[0]/2; direction = image_angle speed += 5 +generate_world(); diff --git a/rooms/rm_game.room.gmx b/rooms/rm_game.room.gmx index 08fe017..e4b05d5 100644 --- a/rooms/rm_game.room.gmx +++ b/rooms/rm_game.room.gmx @@ -53,6 +53,7 @@ + 0 diff --git a/scripts/generate_world.gml b/scripts/generate_world.gml new file mode 100644 index 0000000..0878c3f --- /dev/null +++ b/scripts/generate_world.gml @@ -0,0 +1,28 @@ +///Generate World Chunks + +show_debug_message(obj_controller_world_gen.generated_count); + +var xmax = obj_player.x - view_wview[0]/2; +var ymax = obj_player.y - view_hview[0]/2; + +for(var xx = 0; xx < view_xview[0]+view_wview[0];xx+=32) +{ + for(var yy = 0; yy < view_yview[0]+view_hview[0];yy+=32) + { var expe = string(xx)+string(yy) + for(var i = 0; i <= obj_controller_world_gen.generated_count; i++) + { + if(obj_controller_world_gen.generated_areas[i] == expe) + { + return 0; + } + } + obj_controller_world_gen.generated_areas[obj_controller_world_gen.generated_count] = expe; + obj_controller_world_gen.generated_count ++; + + if(random_range(0,10) > 5) + { + instance_create(xx,yy,obj_asteriod); + } + } +} +