completed set_player

This commit is contained in:
Timothy GFO 2023-10-24 01:40:17 -04:00
parent 07a393b9b7
commit 85c21c2ec5
3 changed files with 33 additions and 21 deletions

View file

@ -125,7 +125,6 @@ def set_values(key, x="", y="", value=""):
else:
Exception("no value specified in set_values. that is ironic.")
#def check_overlap(x,y):
@ -183,9 +182,9 @@ def set_tile(x, y, tilename="mm1cuttile", tile_type="normal", tile_subtype=False
x16 = str(by16[0])
y16 = str(by16[1])
if is_block_used(x, y):
#if is_block_used(x, y):
#this needs a check to see if the coordinates are already taken, and deal with object-tile conflicts accordingly.
opt = get_options()
# opt = get_options()
#WIP
option = 0
error = False
@ -240,16 +239,17 @@ def del_tile(x,y,times_16=False):
y = str(by16[1])
for letter in definitions.block_with_coordinates:
current = f"{letter}{x},{y}
current = f"{letter}{x},{y}"
config.remove_option(section, current)
### should check if there is another "1t" (and maybe "r" and "e" idk) and delete everything on that tile.
def set_player(x, y,player_type="mm",direction="right", allow_duplicates=False):
def set_player(x, y, player_type="mm",direction="right", allow_duplicates=False):
by16 = conv_coordinates_x16(x, y)
x16 = str(by16[0])
y16 = str(by16[1]) #Every function that has something like all this should be a funcion.
if is_block_used(x, y):
#this should check if what is there is a player, if so then only replace the values?
del_tile(x16, y16)
type_lookup = {
@ -259,16 +259,18 @@ def set_player(x, y,player_type="mm",direction="right", allow_duplicates=False):
"r":{"r":"4", "1t":"3","e":"3"}
}
a = "1"
d = "4"
player_dictionary = type_lookup[player_type]
player_dictionary["a"] = "1"
player_dictionary["d"] = "4"
#this should reset after function ends (so remove b from dictionary)
if direction == "left":
player_dictionary["b"] = "-1"
for key in player_dictionary:
value = player_dictionary[key]
full_key = f"{key}{x16},{y16}"
#this is needed because 1t doesn't have coordinate values in the key'
if key == "1t":
full_key = key
config.set(section,full_key, value)