示例#1
0
class Zork:
	def __init__(self):
		 self.myPlayer = Player()
		 self.grid = Neighborhood()
		 
	def splashScreen(self):
		print("Welcome to Zork!")
		print("Just attack some houses and see if you survive")
		print("You only have an HP from 100-125 so watch out")
		
	
	def play(self):
		while self.hp <= 0:
			print("You can attack one house at a time")
			print("A weapon will be randomly chosen for you")
			print("Choices:")
			print("Attack")
			print("Run")
			i = raw_input("What would you like to do?")
			self.input(i)
	
	def input(self, i):
		if (n == "Attack"):
			power = self.myPlayer.attack()
			#use this power to attack all monsters in a house
			
			
		elif (n == "Run"):
			sys.exit("At least you tried")	
		
		else:
			print("Not a valid command")
示例#2
0
    def __init__(self, window, player1, player2):
        self.window = window
        self.p1 = Player(player1, None)
        self.p2 = Player(player2, None)
        background = Image(Point(600, 400), "ImagesAndSprites/StartScreen.gif")
        background.draw(window)
        self.createHealthBars(window)
        self.startGame(window)
        self.countDown = Text(
            Point(window.getWidth() / 2,
                  window.getHeight() / 2), '')
        self.countdown(window)
        self.plyJumpRender = Image(Point(300, 50),
                                   "ImagesAndSprites/Apple.gif")
        self.plyJumpRender.draw(window)

        self.plyJumpRender2 = Image(Point(900, 50),
                                    "ImagesAndSprites/Apple.gif")
        self.plyJumpRender2.draw(window)
        # plyJumpRender2.move(150, 0)

        self.worldRenderer = Image(Point(800, 3), "ImagesAndSprites/blue.gif")
        self.worldRenderer.draw(window)
        self.worldRenderer.move(-200, 400)

        # Hitbox defines as
        # Obj, width, height, weight, pos, ignored
        self.plyJump = hitbox(self.plyJumpRender, 1)
        self.plyJump2 = hitbox(self.plyJumpRender2, 1)
        self.platform = hitbox(self.worldRenderer, 0)
        self.time1 = 0
        self.time2 = 0
        while True:
            self.update(window)
            if (self.getWinner() == 1):
                p1wins(window)
                time.sleep(2)
                break
            if (self.getWinner() == 2):
                p2wins(window)
                time.sleep(2)
                break
示例#3
0
def initialize():

    Gauntlet = Fist()
    Guard_Stick = Night_Stick()
    Jeans = Fun_Jeans()

    name = input("What is your name? \n>")
    Main_Character = Player(name, 15, 45, 3, Gauntlet, None)
    Bill = Enemy("Bill", 15, 100, 2, Guard_Stick, None)
    Front = Entrance("Entrance", "you reach dunder", "n", {
        "go left": "Parking Lot",
        "go forward": "Front Door"
    })
    ParkingLot = Parking_Lot("Parking_Lot", "you see Michael's car!", "n", {
        "north": "Michael's Car",
        "south": "Entrance"
    })
    #Main_Character.begin_attack(Main_Character, Bill)
    map = {Front: "Entrance", ParkingLot: "Parking_Lot"}
    return (Main_Character, map)
示例#4
0
# CS 30
# Period 4
# Date : 12/9/2019
# Krutik Rana
# Program description : Map of the game
from Characters import Player

player = Player(3, 6)


class MapTile:
    """Parent Class to child classes in terms of position and naming"""
    def __init__(self, x, y):
        # x position of map tiles
        self.x = x
        # y position of map tiles
        self.y = y

    def __str__(self):
        """Gets the name of the child class and makes it a string"""
        return self.name


class Ethereal(MapTile):
    """Final Lake Location containing hardest boss and victory for player"""
    def __init__(self, x, y):
        self.name = "Ethereal"
        # Position of Ethereal tile
        super().__init__(x, y)

示例#5
0
	def __init__(self):
		 self.myPlayer = Player()
		 self.grid = Neighborhood()
示例#6
0
import pygame
from GameObjects import RedSquare
from Characters import Player
from Map import MakeMap

dead: bool
boy: Player
move_boy: bool
if __name__ == "__main__":
    pygame.init()
    window = pygame.display.set_mode((800, 600))
    pygame.display.set_caption("ma boi")
    clock = pygame.time.Clock()

    boy = Player(20, 100, 300)

    map_image, mapGOs = MakeMap(
        "assets/maps/map1.csv",
        "assets/platformer-extendedtiles-0/PNG Grass/Spritesheet/sheet.png",
        70, 7)
    # Process GO size. This needs to change.
    for i in range(len(mapGOs)):
        mapGOs[i]._x *= 800 / map_image.get_width()
        mapGOs[i]._y *= 600 / map_image.get_height()
        mapGOs[i]._width *= 800 / map_image.get_width()
        mapGOs[i]._height *= 600 / map_image.get_height()
    map_image = pygame.transform.scale(map_image, (800, 600))

    key_pressed = {
        pygame.K_UP: False,
        pygame.K_DOWN: False,
示例#7
0
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
NUM_OF_COLORS = 3

# Color Switch
colors = {1: YELLOW, 2: WHITE, 3: RED}

# Direction Constants
UP = 'up()'
DOWN = 'down()'
LEFT = 'left()'
RIGHT = 'right()'

# Create Player
character = Player(CAM_W, CAM_H, W, H, YELLOW, PLAYER_RADIUS, PLAYER_SPEED)

# Game Timers
pygame.time.set_timer(USEREVENT + 1, random.randrange(3000, 5000))

# Create Enemies list
enemies = []

# Open game window
size = (CAM_W, CAM_H)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Agar")
background = pygame.surface.Surface((W, H)).convert()
background.fill(BLACK)

示例#8
0
import pygame, sys
from pygame.locals import *
from Level import Level
from Characters import Player


pygame.init()
level = Level()
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
WINDOW = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT), 0, 32)
pygame.display.set_caption("moving rect")
ticker = pygame.time.Clock()
WINDOW.fill((0xFF, 0xFF, 0xFF))
player = Player(WINDOW)
WINDOW.blit(WINDOW, player)
keys_down = []
margin = 50


def check_pos():
    if player.x >= WINDOW_WIDTH - margin:
        level.move_map((-player.step_size, 0))
    if player.x <= margin:
        level.move_map((player.step_size, 0))
    if player.y >= WINDOW_HEIGHT - margin:
        level.move_map((0, -player.step_size))
    if player.y <= margin:
        level.move_map((0, player.step_size))