delete angle property

This commit is contained in:
s464947 2022-04-28 18:43:15 +02:00
parent eec3b64849
commit ab4b404ba4
2 changed files with 8 additions and 8 deletions

View File

@ -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()
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))

View File

@ -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