From ab4b404ba419480679149e8d5b65f2e01e4f6856 Mon Sep 17 00:00:00 2001 From: s464947 Date: Thu, 28 Apr 2022 18:43:15 +0200 Subject: [PATCH] delete angle property --- game_objects/aiPlayer.py | 14 +++++++------- main.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/game_objects/aiPlayer.py b/game_objects/aiPlayer.py index a3239dd..160596e 100644 --- a/game_objects/aiPlayer.py +++ b/game_objects/aiPlayer.py @@ -1,11 +1,12 @@ import pygame as pg +import math +from settings import * vec = pg.math.Vector2 class aiPlayer(): def __init__(self, player, game): self.player = player self.game = game - self.angle = 0 def rotateAiPlayer(self, d: str): if d == 'left': @@ -16,7 +17,7 @@ class aiPlayer(): def moveAiPlayer(self): for i in range(64 * 1): - self.player.pos += vec(1, 0).rotate(self.angle) + self.player.pos += vec(1, 0).rotate(self.player.rot) self.player.rect.center = self.player.pos # print(f'START COORDS: {x_s, x_bias}; CURRENT AGENT COORDS: {self.player.get_actual_coords()}') self.game.update() @@ -28,19 +29,18 @@ class aiPlayer(): def turn_left(self): self.player.rot -= 90 - self.angle -= 90 def turn_right(self): self.player.rot += 90 - self.angle += 90 def startAiController(self, actions): - for action in actions: if action == 'forward': self.moveAiPlayer() - print(f'ROT IS {self.player.rot}') + # print(f'ROT IS {self.player.rot}') if action == 'right': self.turn_right() if action == 'left': - self.turn_left() \ No newline at end of file + self.turn_left() + print(f'ROT: {self.player.rot}') + print("Agent pos: ", math.floor(self.player.pos[0] / TILESIZE), math.floor(self.player.pos[1] / TILESIZE)) \ No newline at end of file diff --git a/main.py b/main.py index 2cd9212..66e175d 100644 --- a/main.py +++ b/main.py @@ -24,7 +24,7 @@ class Game(): self.init_game() # because dont work without data.txt # self.init_bfs() - self.init_a_star() + # self.init_a_star() self.dt = self.clock.tick(FPS) / 1000.0