From: Skullheadx <704277@pdsb.net> Date: Wed, 6 Jul 2022 01:16:48 +0000 (-0400) Subject: added game and player X-Git-Url: http://git.skullheadx.com/nixos/static/git-logo.png?a=commitdiff_plain;h=694d07ed6f79c102cbfae05643af8b8c9c10d76f;p=Pygame-Jam.git added game and player --- diff --git a/Game.py b/Game.py new file mode 100644 index 0000000..d22f73b --- /dev/null +++ b/Game.py @@ -0,0 +1,13 @@ +from Setup import * +from Player import Player + +class Game: + + def __init__(self): + self.player = Player(center) + + def update(self, delta): + self.player.update(delta) + + def draw(self, surf): + self.player.draw(surf) diff --git a/Player.py b/Player.py new file mode 100644 index 0000000..2039bd0 --- /dev/null +++ b/Player.py @@ -0,0 +1,15 @@ +from Setup import * + +class Player: + def __init__(self, pos): + self.position = pg.Vector2(pos) + self.velocity = pg.Vector2(1,0) + + def update(self, delta): + self.position += self.velocity + + # def move_and_collide(pos, vel): + + def draw(self, surf): + pg.draw.circle(surf, (255,0,0), self.position, 10) + \ No newline at end of file diff --git a/Setup.py b/Setup.py new file mode 100644 index 0000000..6e49b54 --- /dev/null +++ b/Setup.py @@ -0,0 +1,16 @@ +import pygame as pg + +pg.init() + +SCREEN_WIDTH, SCREEN_HEIGHT = 1080, 640 +dimensions = (SCREEN_WIDTH, SCREEN_HEIGHT) +center = pg.Vector2(dimensions) / 2 + +pg.display.set_caption("Jam") +# icon = pg.transform.scale(pg.image.load("logo.ico"), (32, 32)) +# pg.display.set_icon(icon) + +clock = pg.time.Clock() +fps = 60 + +screen = pg.display.set_mode(dimensions, pg.SCALED) \ No newline at end of file diff --git a/__pycache__/Game.cpython-39.pyc b/__pycache__/Game.cpython-39.pyc new file mode 100644 index 0000000..0a29beb Binary files /dev/null and b/__pycache__/Game.cpython-39.pyc differ diff --git a/__pycache__/Player.cpython-39.pyc b/__pycache__/Player.cpython-39.pyc new file mode 100644 index 0000000..1a4444d Binary files /dev/null and b/__pycache__/Player.cpython-39.pyc differ diff --git a/__pycache__/Setup.cpython-39.pyc b/__pycache__/Setup.cpython-39.pyc new file mode 100644 index 0000000..0bf57cd Binary files /dev/null and b/__pycache__/Setup.cpython-39.pyc differ diff --git a/game_doc.txt b/game_doc.txt new file mode 100644 index 0000000..8a67839 --- /dev/null +++ b/game_doc.txt @@ -0,0 +1,20 @@ +Interdimension Pirate +- spaceship is a pirate ship (art) +- + +List of Dimensions: +- sky +- cave +- boss dimension + +Gameplay: +- dialogue between npcs +- combat, parkour, building, mining + +story +- stars fall out of the sky and other people collected them including the player +- player tries to collect them from each dimension to get to the boss dimension where they came from + +to find the big treasure +but u have to fight the end dimensional being + diff --git a/main.py b/main.py index 07e0b3f..7c7128d 100644 --- a/main.py +++ b/main.py @@ -1,20 +1,7 @@ -import pygame as pg +from Setup import * +from Game import Game - -pg.init() - -SCREEN_WIDTH, SCREEN_HEIGHT = 1080, 640 -dimensions = (SCREEN_WIDTH, SCREEN_HEIGHT) -center = pg.Vector2(dimensions) / 2 - -pg.display.set_caption("Jam") -# icon = pg.transform.scale(pg.image.load("logo.ico"), (32, 32)) -# pg.display.set_icon(icon) - -clock = pg.time.Clock() -fps = 60 - -screen = pg.display.set_mode(dimensions, pg.SCALED) +scene = Game() delta = 1000//fps is_running = True @@ -24,6 +11,9 @@ while is_running: if pg.event.peek(pg.QUIT, pump=True): is_running = False + scene.update(delta) + scene.draw(screen) + pg.display.update() delta = clock.tick(fps)