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

@@ -17,7 +17,7 @@ class Config(object):
"""
A simple class dedicated to loading, storing and organizing constants.
"""
# Constants
SCREEN_WIDTH = 1650
SCREEN_HEIGHT = 1000
@@ -41,7 +41,6 @@ class Config(object):
RIGHT_VIEWPORT_MARGIN = 250
BOTTOM_VIEWPORT_MARGIN = 50
TOP_VIEWPORT_MARGIN = 100
class Enums(Enum):

View File

@@ -11,9 +11,10 @@ import math
from config import Config
from map import Dungeon
from mobs import Player, Enemy
from config import Config, Sprites
from config import Config
from projectiles import Temp
class Game(arcade.Window):
"""
Main application class.
@@ -79,11 +80,10 @@ class Game(arcade.Window):
self.dungeon.render()
self.player.draw()
self.enemy_list.draw()
self.wall_list.draw()
self.bullet_list.draw()
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):
"""Called whenever a key is pressed. """
@@ -128,8 +128,8 @@ class Game(arcade.Window):
# Create a bullet TEMP SPRITE, currently wielding frog slingshot
bullet = Temp()
# Position the bullet at the player's current location
start_x = self.player_list.center_x
start_y = self.player_list.center_y
start_x = self.player.center_x
start_y = self.player.center_y
bullet.center_x = start_x
bullet.center_y = start_y
@@ -198,21 +198,21 @@ class Game(arcade.Window):
self.view_bottom,
Config.SCREEN_HEIGHT + self.view_bottom)
#Projectile updates
# Projectile updates
self.bullet_list.update()
for bullet in self.bullet_list:
# 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 len(hit_list) > 0:
bullet.remove_from_sprite_lists()
# 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()
def main() -> None:
"""
Setups up window classes and runs the game.

View File

@@ -5,8 +5,6 @@ Organizes classes related to projectiles
import arcade
from config import Config, Sprites
class Projectile(arcade.Sprite):
"""
@@ -15,11 +13,11 @@ class Projectile(arcade.Sprite):
def __init__(self, speed=7, damage=0, range=100, *args, **kwargs) -> None:
# Set up parent class
super().__init__()
self.speed = speed
self.damage = damage #unimplemented
self.damage = damage # unimplemented
self.texture = None
self.range = range #unimplemented
self.range = range # unimplemented
self.collision_list = []
@@ -31,7 +29,7 @@ class Temp(Projectile):
super(Temp, self).__init__(*args, **kwargs)
self.texture = arcade.load_texture("resources/images/monsters/frog/frog1.png")
self.speed = 12
self.scale = 2
#collision list for who/what to collide with: wall, player, enemy
self.scale = 4
# 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