mirror of
https://github.com/n0remac/game-jam-2020.git
synced 2026-01-31 08:22:12 -06:00
remove config excess, add projectiles folder and temp classes
This commit is contained in:
@@ -29,7 +29,6 @@ class Config(object):
|
|||||||
# Constants used to scale our sprites from their original size
|
# Constants used to scale our sprites from their original size
|
||||||
CHARACTER_SCALING = 1
|
CHARACTER_SCALING = 1
|
||||||
TILE_SCALING = 2
|
TILE_SCALING = 2
|
||||||
BULLET_SCALING = 0.8
|
|
||||||
|
|
||||||
# The number of pixels across the level
|
# The number of pixels across the level
|
||||||
LEVEL_SIZE = 10 * TILE_SCALING * TILE_WIDTH
|
LEVEL_SIZE = 10 * TILE_SCALING * TILE_WIDTH
|
||||||
@@ -43,9 +42,6 @@ class Config(object):
|
|||||||
BOTTOM_VIEWPORT_MARGIN = 50
|
BOTTOM_VIEWPORT_MARGIN = 50
|
||||||
TOP_VIEWPORT_MARGIN = 100
|
TOP_VIEWPORT_MARGIN = 100
|
||||||
|
|
||||||
#Bullet constants TEMP change to speed factor in projectiles.py
|
|
||||||
BULLET_SPEED = 5
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Enums(Enum):
|
class Enums(Enum):
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ import math
|
|||||||
|
|
||||||
from config import Config
|
from config import Config
|
||||||
from map import Dungeon
|
from map import Dungeon
|
||||||
from mobs import Player
|
from mobs import Player, Enemy
|
||||||
|
from config import Config, Sprites
|
||||||
|
from projectiles import Temp
|
||||||
|
|
||||||
class Game(arcade.Window):
|
class Game(arcade.Window):
|
||||||
"""
|
"""
|
||||||
@@ -125,8 +126,7 @@ class Game(arcade.Window):
|
|||||||
Called whenever the mouse is clicked.
|
Called whenever the mouse is clicked.
|
||||||
"""
|
"""
|
||||||
# Create a bullet TEMP SPRITE, currently wielding frog slingshot
|
# Create a bullet TEMP SPRITE, currently wielding frog slingshot
|
||||||
bullet = arcade.Sprite("resources/images/monsters/frog/frog1.png", Config.BULLET_SCALING)
|
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_list.center_x
|
||||||
start_y = self.player_list.center_y
|
start_y = self.player_list.center_y
|
||||||
@@ -149,8 +149,8 @@ class Game(arcade.Window):
|
|||||||
|
|
||||||
# Taking into account the angle, calculate our change_x
|
# Taking into account the angle, calculate our change_x
|
||||||
# and change_y. Velocity is how fast the bullet travels.
|
# and change_y. Velocity is how fast the bullet travels.
|
||||||
bullet.change_x = math.cos(angle) * Config.BULLET_SPEED
|
bullet.change_x = math.cos(angle) * bullet.speed
|
||||||
bullet.change_y = math.sin(angle) * Config.BULLET_SPEED
|
bullet.change_y = math.sin(angle) * bullet.speed
|
||||||
|
|
||||||
# Add the bullet to the appropriate lists
|
# Add the bullet to the appropriate lists
|
||||||
self.bullet_list.append(bullet)
|
self.bullet_list.append(bullet)
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
"""
|
||||||
|
projectiles.py
|
||||||
|
Organizes classes related to projectiles
|
||||||
|
"""
|
||||||
|
|
||||||
|
import arcade
|
||||||
|
|
||||||
|
from config import Config, Sprites
|
||||||
|
|
||||||
|
|
||||||
|
class Projectile(arcade.Sprite):
|
||||||
|
"""
|
||||||
|
Represents a Projectile. Damage, sprite, speed, range, collision list?
|
||||||
|
"""
|
||||||
|
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.texture = None
|
||||||
|
self.range = range #unimplemented
|
||||||
|
self.collision_list = []
|
||||||
|
|
||||||
|
|
||||||
|
class Temp(Projectile):
|
||||||
|
"""
|
||||||
|
Temporary extension of projectile to demonstrate usage
|
||||||
|
"""
|
||||||
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
|
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
|
||||||
|
|
||||||
|
#Can place function for starting on player or enemy
|
||||||
Reference in New Issue
Block a user