From 558cede137e944c9ac66baf5a0c008647211018b Mon Sep 17 00:00:00 2001 From: Rahul Gandharva Date: Thu, 12 Aug 2021 18:58:45 +1000 Subject: [PATCH] Fixed No Mans Land Save. It used to contain a country associated with the black color. --- No Mans Land.save | 70 +++++++++++----------- Scripts/Level_Funcs.gd | 22 +++---- Scripts/Levels/Level Components/Country.gd | 5 +- Scripts/Levels/Level Creator.gd | 2 +- 4 files changed, 51 insertions(+), 48 deletions(-) diff --git a/No Mans Land.save b/No Mans Land.save index 402c038..9601675 100644 --- a/No Mans Land.save +++ b/No Mans Land.save @@ -1,35 +1,35 @@ -{"connections":[10,20,125],"name":15,"troops":1,"x":399,"y":333} -{"connections":[15,165],"name":10,"troops":2,"x":532,"y":203} -{"connections":[10,175,170,160],"name":165,"troops":1,"x":744,"y":294} -{"connections":[175,165],"name":170,"troops":2,"x":699,"y":377} -{"connections":[165,170],"name":175,"troops":1,"x":597,"y":364} -{"connections":[165,155],"name":160,"troops":2,"x":836,"y":275} -{"connections":[160,145,150],"name":155,"troops":2,"x":887,"y":386} -{"connections":[155,150,140],"name":145,"troops":1,"x":948,"y":347} -{"connections":[155,145],"name":150,"troops":3,"x":964,"y":449} -{"connections":[145,0,130],"name":140,"troops":2,"x":1155,"y":274} -{"connections":[140,95],"name":0,"troops":1,"x":1184,"y":400} -{"connections":[140,120],"name":130,"troops":2,"x":1299,"y":223} -{"connections":[130,115,125,110],"name":120,"troops":1,"x":1406,"y":272} -{"connections":[120,110],"name":115,"troops":4,"x":1479,"y":303} -{"connections":[120,15],"name":125,"troops":1,"x":1530,"y":203} -{"connections":[120,115,95,20],"name":110,"troops":3,"x":1470,"y":424} -{"connections":[0,100,110,85],"name":95,"troops":1,"x":1329,"y":530} -{"connections":[95,105],"name":100,"troops":2,"x":1407,"y":606} -{"connections":[100,25],"name":105,"troops":2,"x":1483,"y":694} -{"connections":[95,90,75],"name":85,"troops":3,"x":1206,"y":685} -{"connections":[85],"name":90,"troops":2,"x":1234,"y":809} -{"connections":[85,0,70],"name":75,"troops":2,"x":989,"y":701} -{"connections":[75,65],"name":70,"troops":1,"x":918,"y":711} -{"connections":[70,50,60],"name":65,"troops":2,"x":853,"y":766} -{"connections":[75],"name":0,"troops":2,"x":1031,"y":778} -{"connections":[55,65],"name":60,"troops":2,"x":821,"y":885} -{"connections":[40,60],"name":55,"troops":1,"x":712,"y":909} -{"connections":[45,55,35],"name":40,"troops":1,"x":567,"y":882} -{"connections":[40,30,25],"name":35,"troops":1,"x":366,"y":874} -{"connections":[30,35,20,105],"name":25,"troops":1,"x":311,"y":699} -{"connections":[35,25,45],"name":30,"troops":1,"x":409,"y":756} -{"connections":[50,45,30],"name":45,"troops":1,"x":569,"y":706} -{"connections":[25,15,110,25,15,110],"name":20,"troops":2,"x":309,"y":499} -{"connections":[65,45,45],"name":50,"troops":2,"x":676,"y":672} -{"connections":[45,50,40],"name":45,"troops":3,"x":592,"y":761} +{"connections":[125,20,10,125],"name":15,"troops":2,"x":401.794006,"y":338.588013} +{"connections":[165,15],"name":10,"troops":4,"x":558.794006,"y":199.588013} +{"connections":[165,170],"name":175,"troops":1,"x":597.794006,"y":369.588013} +{"connections":[10,160,170,175],"name":165,"troops":1,"x":660.794006,"y":288.588013} +{"connections":[165,175],"name":170,"troops":2,"x":691.794006,"y":356.588013} +{"connections":[165,155],"name":160,"troops":2,"x":835.794006,"y":280.588013} +{"connections":[160,145,150],"name":155,"troops":1,"x":877.794006,"y":381.588013} +{"connections":[155,150,140],"name":145,"troops":2,"x":945.794006,"y":353.588013} +{"connections":[145,155],"name":150,"troops":2,"x":972.794006,"y":453.588013} +{"connections":[145,135,130],"name":140,"troops":2,"x":1151.793945,"y":269.588013} +{"connections":[140,95],"name":135,"troops":2,"x":1189.793945,"y":413.588013} +{"connections":[140,120],"name":130,"troops":2,"x":1299.793945,"y":225.588013} +{"connections":[130,125,115,110],"name":120,"troops":2,"x":1408.793945,"y":279.588013} +{"connections":[120,15,15],"name":125,"troops":2,"x":1532.793945,"y":203.588013} +{"connections":[120,110],"name":115,"troops":2,"x":1481.793945,"y":314.588013} +{"connections":[120,115,95,20],"name":110,"troops":1,"x":1480.793945,"y":415.588013} +{"connections":[110,135,100,85],"name":95,"troops":1,"x":1334.793945,"y":544.588013} +{"connections":[95,105],"name":100,"troops":4,"x":1425.793945,"y":603.588013} +{"connections":[100,25],"name":105,"troops":2,"x":1477.793945,"y":675.588013} +{"connections":[95,90,75],"name":85,"troops":1,"x":1221.793945,"y":691.588013} +{"connections":[85],"name":90,"troops":2,"x":1236.793945,"y":790.588013} +{"connections":[85,80,70,65],"name":75,"troops":1,"x":991.794006,"y":703.588013} +{"connections":[75,65],"name":70,"troops":3,"x":920.794006,"y":714.588013} +{"connections":[75,70,60,50],"name":65,"troops":1,"x":849.794006,"y":769.588013} +{"connections":[75],"name":80,"troops":3,"x":1031.793945,"y":785.588013} +{"connections":[65,55],"name":60,"troops":4,"x":811.794006,"y":888.588013} +{"connections":[60,40],"name":55,"troops":3,"x":716.794006,"y":921.588013} +{"connections":[55,45,35],"name":40,"troops":1,"x":554.794006,"y":893.588013} +{"connections":[45,65,45],"name":50,"troops":2,"x":651.794006,"y":677.588013} +{"connections":[45,50,30],"name":45,"troops":1,"x":558.794006,"y":708.588013} +{"connections":[45,35,25],"name":30,"troops":1,"x":398.794006,"y":757.588013} +{"connections":[30,40,25],"name":35,"troops":4,"x":347.794006,"y":875.588013} +{"connections":[30,35,20,105],"name":25,"troops":1,"x":323.794006,"y":726.588013} +{"connections":[25,15,110],"name":20,"troops":2,"x":318.794006,"y":502.588013} +{"connections":[40,45,50],"name":45,"troops":2,"x":601.794006,"y":754.588013} diff --git a/Scripts/Level_Funcs.gd b/Scripts/Level_Funcs.gd index 489b78c..96f5edd 100644 --- a/Scripts/Level_Funcs.gd +++ b/Scripts/Level_Funcs.gd @@ -118,14 +118,14 @@ func add_connections(source_country_name, destination_country_names): func get_color_in_mask(): return world_mask.get_pixel(get_local_mouse_position()[0]*2, get_local_mouse_position()[1]*2)*255 -func _input(event): - if event.is_pressed(): - if not (Rect2(Vector2(0,0), world_mask.get_size()).has_point(get_local_mouse_position())): - return - - # Print color of pixel under mouse cursos when clicked - print(get_color_in_mask()) - - var country_name = get_color_in_mask()[0] - if country_name in all_countries: - all_countries[country_name].on_click(event) +#func _input(event): +# if event.is_pressed(): +# if not (Rect2(Vector2(0,0), world_mask.get_size()).has_point(get_local_mouse_position())): +# return +# +# # Print color of pixel under mouse cursos when clicked +# print(get_color_in_mask()) +# +# var country_name = get_color_in_mask()[0] +# if country_name in all_countries: +# all_countries[country_name].on_click(event) diff --git a/Scripts/Levels/Level Components/Country.gd b/Scripts/Levels/Level Components/Country.gd index f54a8ba..2410ae5 100644 --- a/Scripts/Levels/Level Components/Country.gd +++ b/Scripts/Levels/Level Components/Country.gd @@ -61,7 +61,10 @@ func can_attack(): if country.num_troops < num_troops and country.belongs_to != belongs_to: return true return false - + +func _input_event(viewport, event, shape_idx): + if event.is_pressed(): + self.on_click(event) func on_click(event): # Level Creator Behaviour diff --git a/Scripts/Levels/Level Creator.gd b/Scripts/Levels/Level Creator.gd index 3ac3226..cbf0a28 100644 --- a/Scripts/Levels/Level Creator.gd +++ b/Scripts/Levels/Level Creator.gd @@ -9,7 +9,7 @@ var add_countries_button = null var export_level_button = null var connect_countries_button = null var information_label = null -var _world_str = "Crucible" +var _world_str = "No Mans Land" # Called when the node enters the scene tree for the first time. func _ready():