]> Skullheadx's Git Forge - Pygame-Jam.git/commitdiff
added pets
authorSkullheadx <704277@pdsb.net>
Wed, 6 Jul 2022 16:36:04 +0000 (12:36 -0400)
committerSkullheadx <704277@pdsb.net>
Wed, 6 Jul 2022 16:36:04 +0000 (12:36 -0400)
Game.py
Pet.py [new file with mode: 0644]
game_doc.txt

diff --git a/Game.py b/Game.py
index 0cb2e3cc611d636a482f8550ea2d7572a9875844..30fe35ceeb91dc5bd7bc769b5b7c22b20e729c52 100644 (file)
--- a/Game.py
+++ b/Game.py
@@ -1,23 +1,26 @@
 from Setup import *
 from Player import Player
+from Pet import Pet
 from Enemy import Enemy
 from Block import Block
 
 class Game:
 
     def __init__(self):
-        self.collision_layer = {0:set(),1: set(), 2:set()}
-        self.player = Player(center, self.collision_layer[1], [self.collision_layer[2], self.collision_layer[0]])
+        self.collision_layer = {"world":set(),"player": set(), "enemy":set(), "pet":set()}
 
-        self.enemies = [Enemy((SCREEN_WIDTH * 3 /4, 0),self.collision_layer[2], [self.collision_layer[1], self.collision_layer[0]])]
-        self.blocks = [Block((0, SCREEN_HEIGHT * 3 / 4),self.collision_layer[0]),
+        self.player = Player(center, self.collision_layer["player"], [self.collision_layer["enemy"], self.collision_layer["world"]])
+        self.pet = Pet(center, self.collision_layer["pet"], [self.collision_layer["world"]])
+
+        self.enemies = [Enemy((SCREEN_WIDTH * 3 /4, 0),self.collision_layer["enemy"], [self.collision_layer["player"], self.collision_layer["world"]])]
+        self.blocks = [Block((0, SCREEN_HEIGHT * 3 / 4),self.collision_layer["world"])]
                     #    Block((SCREEN_WIDTH/2 - 50, SCREEN_HEIGHT * 3 / 4),self.collision_layer[0]),
                     #    Block((SCREEN_WIDTH/2 + 50, SCREEN_HEIGHT * 3 / 4),self.collision_layer[0]),
 
-                       ]
 
     def update(self, delta):
         self.player.update(delta)
+        self.pet.update(delta, self.player)
 
         for enemy in self.enemies:
             enemy.update(delta, self.player)
@@ -33,4 +36,5 @@ class Game:
             block.draw(surf)
 
         self.player.draw(surf)
+        self.pet.draw(surf)
 
diff --git a/Pet.py b/Pet.py
new file mode 100644 (file)
index 0000000..ca378e6
--- /dev/null
+++ b/Pet.py
@@ -0,0 +1,15 @@
+from Actors import Actor
+
+class Pet(Actor):
+    width,height = 75,50
+
+    def __init__(self, pos, collision_layer, collision_mask):
+        super().__init__(pos, collision_layer, collision_mask)
+    
+    def update(self, delta, target):
+        super().update(delta)
+
+        self.follow_target(target)
+
+        self.position, self.velocity = self.move_and_collide(self.position, self.velocity, delta)
+
index 8a6783970c0a92f1715c2f763cc3ca7f59eaebca..8d38e07d4dab4ad0465258e0f1fce0ecdcd90bbe 100644 (file)
@@ -9,7 +9,7 @@ List of Dimensions:
 
 Gameplay:
 - dialogue between npcs
-- combat, parkour, building, mining
+- combat, exploration
 
 story
 - stars fall out of the sky and other people collected them including the player