removed whitespace and other formatting.

This commit is contained in:
Cameron Smart
2020-04-20 13:45:49 -07:00
parent c051414870
commit dff882770d
3 changed files with 16 additions and 19 deletions

View File

@@ -43,7 +43,6 @@ class Config(object):
TOP_VIEWPORT_MARGIN = 100 TOP_VIEWPORT_MARGIN = 100
class Enums(Enum): class Enums(Enum):
""" """
A simple class used for tracking different simple A simple class used for tracking different simple

View File

@@ -11,9 +11,10 @@ import math
from config import Config from config import Config
from map import Dungeon from map import Dungeon
from mobs import Player, Enemy from mobs import Player, Enemy
from config import Config, Sprites from config import Config
from projectiles import Temp from projectiles import Temp
class Game(arcade.Window): class Game(arcade.Window):
""" """
Main application class. Main application class.
@@ -79,11 +80,10 @@ class Game(arcade.Window):
self.dungeon.render() self.dungeon.render()
self.player.draw() self.player.draw()
self.enemy_list.draw() self.enemy_list.draw()
self.wall_list.draw()
self.bullet_list.draw() self.bullet_list.draw()
x, y = self.player.center_x, self.player.center_y + 100 x, y = self.player.center_x, self.player.center_y + 100
arcade.draw_text(f"({x}, {y})", x, y, arcade.color.WHITE, 15) # arcade.draw_text(f"({x}, {y})", x, y, arcade.color.WHITE, 15)
def on_key_press(self, key, modifiers): def on_key_press(self, key, modifiers):
"""Called whenever a key is pressed. """ """Called whenever a key is pressed. """
@@ -128,8 +128,8 @@ class Game(arcade.Window):
# Create a bullet TEMP SPRITE, currently wielding frog slingshot # Create a bullet TEMP SPRITE, currently wielding frog slingshot
bullet = Temp() bullet = Temp()
# Position the bullet at the player's current location # Position the bullet at the player's current location
start_x = self.player_list.center_x start_x = self.player.center_x
start_y = self.player_list.center_y start_y = self.player.center_y
bullet.center_x = start_x bullet.center_x = start_x
bullet.center_y = start_y bullet.center_y = start_y
@@ -202,17 +202,17 @@ class Game(arcade.Window):
self.bullet_list.update() self.bullet_list.update()
for bullet in self.bullet_list: for bullet in self.bullet_list:
# Collision Checks # Collision Checks
hit_list = arcade.check_for_collision_with_list(bullet, self.wall_list) hit_list = arcade.check_for_collision_with_list(bullet, self.dungeon.getWalls())
# If it did, get rid of the bullet # If it did, get rid of the bullet
if len(hit_list) > 0: if len(hit_list) > 0:
bullet.remove_from_sprite_lists() bullet.remove_from_sprite_lists()
# If the bullet flies off-screen, remove it. TEMP change to range calc # If the bullet flies off-screen, remove it. TEMP change to range calc
if bullet.bottom < self.view_bottom or bullet.top > self.view_bottom+Config.SCREEN_HEIGHT or bullet.right > self.view_left+Config.SCREEN_WIDTH or bullet.left < self.view_left: if (bullet.bottom < self.view_bottom or bullet.top > self.view_bottom+Config.SCREEN_HEIGHT
or bullet.right > self.view_left+Config.SCREEN_WIDTH or bullet.left < self.view_left):
bullet.remove_from_sprite_lists() bullet.remove_from_sprite_lists()
def main() -> None: def main() -> None:
""" """
Setups up window classes and runs the game. Setups up window classes and runs the game.

View File

@@ -5,8 +5,6 @@ Organizes classes related to projectiles
import arcade import arcade
from config import Config, Sprites
class Projectile(arcade.Sprite): class Projectile(arcade.Sprite):
""" """
@@ -31,7 +29,7 @@ class Temp(Projectile):
super(Temp, self).__init__(*args, **kwargs) super(Temp, self).__init__(*args, **kwargs)
self.texture = arcade.load_texture("resources/images/monsters/frog/frog1.png") self.texture = arcade.load_texture("resources/images/monsters/frog/frog1.png")
self.speed = 12 self.speed = 12
self.scale = 2 self.scale = 4
# collision list for who/what to collide with: wall, player, enemy # collision list for who/what to collide with: wall, player, enemy
# Can place function for starting on player or enemy # Can place function for starting on player or enemy