Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def process_Data():
- arr = []
- def processUnit(obj):
- arr.append(obj.health)
- arr.append(obj.position.x)
- arr.append(obj.position.y)
- arr.append(obj.size.x)
- arr.append(obj.size.y)
- if obj.jump_state.can_cancel == False:
- arr.append(0)
- else:
- arr.append(1)
- if obj.jump_state.can_jump == False:
- arr.append(0)
- else:
- arr.append(1)
- arr.append(obj.jump_state.max_time)
- arr.append(obj.jump_state.speed)
- if obj.walked_right == False:
- arr.append(0)
- else:
- arr.append(1)
- if obj.stand == False:
- arr.append(0)
- else:
- arr.append(1)
- if obj.on_ground == False:
- arr.append(0)
- else:
- arr.append(1)
- if obj.on_ladder == False:
- arr.append(0)
- else:
- arr.append(1)
- arr.append(obj.mines)
- if obj.weapon != None:
- arr.append(obj.weapon.params.fire_rate)
- arr.append(obj.weapon.params.reload_time)
- arr.append(obj.weapon.params.min_spread)
- arr.append(obj.weapon.params.max_spread)
- arr.append(obj.weapon.params.aim_speed)
- arr.append(obj.weapon.params.bullet.speed)
- arr.append(obj.weapon.params.bullet.size)
- arr.append(obj.weapon.params.bullet.damage)
- else:
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- posX = int(game.units[0].position.x)
- posY = int(game.units[0].position.y)
- leftX = -1
- leftY = -1
- if posX - 5 < 0:
- leftX = posX
- elif posX + 5 >= 40:
- leftX = posX - 10
- else:
- leftX = posX - 5
- if posY - 5 < 0:
- leftY = posY
- elif posY + 5 >= 30:
- leftY = posY - 10
- else:
- leftY = posY - 5
- for i in range(leftX,leftX+10):
- for j in range(leftY,leftY+10):
- arr.append(game.level.tiles[i][j].value)
- processUnit(game.units[0])
- processUnit(game.units[1])
- arr_l = len(arr)
- if game.bullets != []:
- for i in game.bullets:
- if (game.units[0].position.x < game.units[1].position.y and i.velocity.x < 0) or (game.units[0].position.y < game.units[1].position.y and i.velocity.y < 0) or (game.units[0].position.x > game.units[1].position.x and i.velocity.x > 0) or (game.units[0].position.y > game.units[1].position.y and i.velocity.y > 0):
- arr.append(i.position.x)
- arr.append(i.position.y)
- arr.append(i.velocity.x)
- arr.append(i.velocity.y)
- arr.append(i.damage)
- arr.append(i.size)
- arr.append(i.explosion_params.damage)
- arr.append(i.explosion_params.radius)
- arr_l += 1
- for i in range(len(arr) - arr_l,20):
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- diff = []
- for i in game.mines:
- if game.units[0].position.x - i.position.x < 0:
- diff.append((game.units[0].position.x - i.position.x)*(-1))
- else:
- diff.append(game.units[0].position.x - i.position.x)
- diff.sort()
- nr = 0
- for i in range(0,len(diff)):
- if nr == 2:
- break
- for j in game.mines:
- d = 0
- if game.units[0].position.x - j.position.x < 0:
- d = (game.units[0].position.x - j.position.x)*(-1)
- if d == diff[i]:
- arr.append(j.position.x)
- arr.append(j.position.y)
- arr.append(j.size.x)
- arr.append(j.size.y)
- arr.append(j.state)
- nr += 1
- while nr < 2:
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- nr += 1
- nr = 0
- diff = []
- for i in game.loot_boxes:
- if game.units[0].position.x - i.position.x < 0:
- diff.append((game.units[0].position.x - i.position.x)*(-1))
- else:
- diff.append(game.units[0].position.x - i.position.x)
- diff.sort()
- nr = 0
- for i in range(0,len(diff)):
- if nr == 6:
- break
- for j in game.loot_boxes:
- d = 0
- if game.units[0].position.x - j.position.x < 0:
- d = (game.units[0].position.x - j.position.x)*(-1)
- if d == diff[i]:
- arr.append(j.position.x)
- arr.append(j.position.y)
- arr.append(j.size.x)
- arr.append(j.size.y)
- if str(type(j.item)) == "<class 'model.item.Weapon'>":
- arr.append(j.item.weapon_type + 1)
- elif str(type(j.item)) == "<class 'model.item.Mine'>":
- arr.append(4)
- elif str(type(j.item)) == "<class 'model.item.HealthPack'>":
- arr.append(5)
- nr += 1
- while nr < 6:
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- arr.append(0)
- nr+=1
- return arr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement