mirror of
https://github.com/n0remac/game-jam-2020.git
synced 2025-12-09 22:05:19 -06:00
add new continuous integration file
This commit is contained in:
31
triple-dungeon/.github/workflows/ci.yml
vendored
Normal file
31
triple-dungeon/.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: Continuous Integration (PEP8 Lint + pytest)
|
||||||
|
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python 3.7
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: 3.7
|
||||||
|
- name: Install pipenv & sync
|
||||||
|
run: |
|
||||||
|
cd triple-dungeon
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install pipenv
|
||||||
|
pipenv lock
|
||||||
|
pipenv sync
|
||||||
|
- name: Linting
|
||||||
|
run: |
|
||||||
|
pip install pycodestyle
|
||||||
|
# PyCharm sets line length at 120 chars
|
||||||
|
pycodestyle . --count --statistics --max-line-length=120
|
||||||
|
- name: Test with pytest
|
||||||
|
run: |
|
||||||
|
pip install pytest
|
||||||
|
pytest tests.py
|
||||||
@@ -5,15 +5,15 @@ Holds the main game window, as well as manages basic functions for organizing th
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
|
import math
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import arcade
|
import arcade
|
||||||
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
|
||||||
from config import Config
|
|
||||||
from projectiles import Temp
|
from projectiles import Temp
|
||||||
|
|
||||||
|
|
||||||
@@ -106,7 +106,8 @@ class Game(arcade.Window):
|
|||||||
if Config.DEBUG:
|
if Config.DEBUG:
|
||||||
x, y = self.player.position
|
x, y = self.player.position
|
||||||
tile = Config.TILE_WIDTH * Config.TILE_SCALING
|
tile = Config.TILE_WIDTH * Config.TILE_SCALING
|
||||||
arcade.draw_rectangle_outline(round(x / tile) * tile, round(y / tile) * tile, tile, tile, arcade.color.RED)
|
arcade.draw_rectangle_outline(round(x / tile) * tile, round(y / tile) * tile, tile, tile,
|
||||||
|
arcade.color.RED)
|
||||||
self.player.draw_hit_box()
|
self.player.draw_hit_box()
|
||||||
arcade.draw_text(str((x, y)), x - 40, y + 50, arcade.color.WHITE, 15, font_name='Arial')
|
arcade.draw_text(str((x, y)), x - 40, y + 50, arcade.color.WHITE, 15, font_name='Arial')
|
||||||
arcade.draw_text(f"FPS: {self.fps.get_fps():3.0f}", self.view_left + 50, self.view_bottom + 30,
|
arcade.draw_text(f"FPS: {self.fps.get_fps():3.0f}", self.view_left + 50, self.view_bottom + 30,
|
||||||
@@ -165,8 +166,8 @@ class Game(arcade.Window):
|
|||||||
bullet.center_y = start_y
|
bullet.center_y = start_y
|
||||||
|
|
||||||
# Get from the mouse the destination location for the bullet
|
# Get from the mouse the destination location for the bullet
|
||||||
dest_x = x+self.view_left
|
dest_x = x + self.view_left
|
||||||
dest_y = y+self.view_bottom
|
dest_y = y + self.view_bottom
|
||||||
|
|
||||||
# Do math to calculate how to get the bullet to the destination.
|
# Do math to calculate how to get the bullet to the destination.
|
||||||
# Calculation the angle in radians between the start points
|
# Calculation the angle in radians between the start points
|
||||||
@@ -241,10 +242,10 @@ class Game(arcade.Window):
|
|||||||
|
|
||||||
# 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 (
|
if (
|
||||||
bullet.bottom < self.view_bottom or
|
bullet.bottom < self.view_bottom or
|
||||||
bullet.top > self.view_bottom+Config.SCREEN_HEIGHT or
|
bullet.top > self.view_bottom + Config.SCREEN_HEIGHT or
|
||||||
bullet.right > self.view_left+Config.SCREEN_WIDTH or
|
bullet.right > self.view_left + Config.SCREEN_WIDTH or
|
||||||
bullet.left < self.view_left
|
bullet.left < self.view_left
|
||||||
):
|
):
|
||||||
bullet.remove_from_sprite_lists()
|
bullet.remove_from_sprite_lists()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user