def __init__(self):
        # auteur Gabriel Desmullier
        #initialisation de la partie
        self.level = 1
        self.heroVivant = True
        print(
            "*  ** *** ** ** ** *** * ** * ** ***   *** * ** * ** * ** * * ** "
        )
        print(
            "               ASCII ADVENTURE            /\ /\         / \      "
        )
        print(
            "             G                           /  /   \  /\  /    \    "
        )
        print(
            ",,_,__,__,,,-M0 ,,__,_,_,,,____,,,__,_,_/         /  /        \  "
        )
        print(
            "***,**,**,*',',* * *,,,'''*,* **,* *'**'* **,* ** *'''** ** ,* **"
        )

        nomHero = str(input("Quel est votre nom?\n"))
        while nomHero.upper(
        ) == "ROMAIN":  #petite blague pour ceux qui voudraient appeller leur personnage Romain
            nomHero = str(input("Quel est votre nom?\n"))

        self.hero = ch.Hero(0, nomHero, 1, 1)

        print(
            "Votre mission " + self.hero.name +
            " sera de ramasser le plus de fleurs magiques * parmi les fleurs *.\nIl n'y a qu'une seule fleur magique par niveau. Trouvez cette fleur et vous changerez de niveau.\nPrenez garde! les monstre M sont nombreux.\nAllez rencontrer des marchands C pour ameliorer votre equipement.\nDeplacez vous avec z,q,s,d et accedez a votre inventaire avec a\nEntrez n'importe quoi pour commencer\n"
        )
        commencer = str(input())
Ejemplo n.º 2
0
    def __init__(self):

        self.tiles = 10
        self.floor = Floor()
        self.wall = Wall()
        self.boss = character.Boss()
        self.skeleton = character.Skeleton()
        self.hero = character.Hero()
Ejemplo n.º 3
0
 def __init__(self, screen, map):
     self.screen = screen
     self.monster_group = pygame.sprite.Group()
     self.hero_group = pygame.sprite.Group()
     self.map = map
     hero = character.Hero(self.screen, 4, 4, self.map)
     self.hero_group.add(hero)
     green_slime = character.Slime_Green(self.screen, 3, 3, self.map)
     self.monster_group.add(green_slime)
Ejemplo n.º 4
0
 def __init__(self):
     self.map = map_of_game.Game_Map()
     self.view = View()
     self.hero = character.Hero()
     self.boss = character.Boss()
     self.skeltons = character.Skeleton()
     self.view.display_map(self.map.board)
     self.boss_position()
     self.skeletons_position()
     self.battle = Battle(self.hero, self.boss)
     self.input_event()
     self.view.display_hero_down(72 + self.hero.x_pos * self.view.size,
                                 72 + self.hero.y_pos * self.view.size)
     self.view.root.mainloop()
Ejemplo n.º 5
0
 def start(self):
     self.characters = dict()
     self.hero = character.Hero(4)
     self.cat = character.Tiger(self.n-1)
     self.state = State.HUNT
     self.active = True
     self.gamefield = self.get_game_field()
     self.turns_hidden = 0
     self.characters["hero"] = self.hero
     self.characters["cat"] = self.cat
     self.header = "\n"
     self.header2 = "\n"
     self.state_dict = {State.HUNT: self.handle_state_HUNT,
                        State.HIDE: self.handle_state_HIDE,
                        State.VICTORY_HIDE: self.handle_state_VICTORY_HIDE,
                        State.RUN: self.handle_state_RUN,
                        State.DEAD: self.handle_state_DEAD,
                        State.VICTORY_RUN: self.handle_state_VICTORY_RUN,
                        State.GUN: self.handle_state_GUN,
                        State.FEED: self.handle_state_FEED,
                        State.WELLFED: self.handle_state_WELLFED,
                        }
     self.handle_state_HUNT()
     self.update_game_field()
Ejemplo n.º 6
0
import character as c

window = 0
half_w = 5.0
half_h = 3.0
half_d = 2.5

hero = c.Hero()
villain = c.Villain()
rain = []
c.pygame.mixer.init()
c.pygame.init()


def init_scene(width, height):
    # specify background colour of window after clearing of colour buffers RGBA
    c.glClearColor(0.0, 0.0, 0.0, 0.0)
    c.glClearDepth(1.0)
    # pixel drawn only if incoming depth value is less than stored depth value (for overlapping faces)
    c.glDepthFunc(c.GL_LESS)
    # enable depth test specified above
    c.glEnable(c.GL_DEPTH_TEST)
    c.glPolygonMode(c.GL_FRONT, c.GL_FILL)
    c.glPolygonMode(c.GL_BACK, c.GL_FILL)
    c.glShadeModel(c.GL_SMOOTH)
    # allows visualisation of variations in z coordinate with respect to viewing point
    c.glMatrixMode(c.GL_PROJECTION)
    c.glLoadIdentity()
    # 45 degree field view, aspect ratio, display range 0.1 to 100
    c.gluPerspective(45.0, float(width) / float(height), 0.1, 100.0)
    # define in terms of world coordinates view used also
Ejemplo n.º 7
0
    '''
    try:
        fd = sys.stdin.fileno()
        tty_settings = termios.tcgetattr(fd)
        tty.setraw(fd)

        key = sys.stdin.read(1)
    finally:
        termios.tcsetattr(fd, termios.TCSADRAIN, tty_settings)
    return key


if __name__ == '__main__':
    # Initialize the first level

    mc = character.Hero("Max", 0, 0, 0, 0)

    levels = []
    monsters = []

    current = 0

    res = make_level()
    levels.append(res[0])
    monsters.append(res[1])

    pos = find_staircase(levels[current], '<')

    curhp = maxhp = 10

    while True:
Ejemplo n.º 8
0
import pygame
import character

pygame.init()

white = (255, 255, 255)
green = (0, 255, 0)
blue = (0, 0, 128)

X = 600
Y = 600

# characterSheet = __str__ method from class Hero ***************************************
bob = character.Hero()
characterSheet = bob.__str__()
charList = characterSheet.split('\n')

print(charList)

display_surface = pygame.display.set_mode((X, Y))
pygame.display.set_caption('Show Text')
font = pygame.font.Font('freesansbold.ttf', 32)


def print2screen(charList):
    vartop = 0
    for line in charList:
        text = font.render(line, True, blue, white)
        textRect = text.get_rect()
        textRect.top = vartop
        vartop += 40
Ejemplo n.º 9
0
#!/usr/bin/env python

# In this simple RPG game, the hero fights the goblin. He has the options to:

# 1. fight goblin
# 2. do nothing - in which case the goblin will attack him anyway
# 3. flee

import character

dude=character.Hero()
bad_dude=character.Goblin()

def main():
#    hero_health = dude.health
#    hero_power = dude.power
#    goblin_health = bad_dude.health
#    goblin_power = bad_dude.power


    while bad_dude.health > 0 and dude.health > 0:
        print("You have {} health and {} power.".format(dude.health, dude.power))
        print("The goblin has {} health and {} power.".format(bad_dude.health, bad_dude.power))
        print()
        print("What do you want to do?")
        print("1. fight goblin")
        print("2. do nothing")
        print("3. flee")
        print("> ", end=' ')
        raw_input = input()
        if raw_input == "1":
Ejemplo n.º 10
0
# This module is responsible for managing the game,
# controlling the win-loose logic and displaying the score

import time

import character as ch

# Create characters instances
needle = ch.Object(0, "Needle.png")
ether = ch.Object(1, "Ether.png")
plastic_tube = ch.Object(2, "Plastic_tube.png")
guardian = ch.Enemy()
macgyver = ch.Hero()


class Game:
    """This class is responsible for launching the game,
    controlling the win-loose logic and displaying the score"""
    def __init__(self):
        """Defines game properties"""
        self.score = 0

    def main(self):
        """Main function of the game that controls launching, playing,
        winning or loosing and quitting"""
        # Draw our Characters
        ch.st.SURFACE.blit(ether.image, ether.position)
        ch.st.SURFACE.blit(plastic_tube.image, plastic_tube.position)
        ch.st.SURFACE.blit(needle.image, needle.position)
        ch.st.SURFACE.blit(guardian.image, guardian.position)
        # Draw the maze on the screen
Ejemplo n.º 11
0
        if levelname.startswith('_') == True and levelname.endswith(
                '__') == False:
            class_levels_list.append(getattr(levels, levelname))
    return class_levels_list


#create objects (cosmic forces)

son = functions.Son()
control = controller.Holy_Spirit()

if len(sys.argv) > 1:
    if sys.argv[1] == 'test':

        control.auto = False

battle = functions.Battle()  #to delete

compose_text = functions.Compose_dialog_tree(control, son)

levels_list, levels_dict = levels_constructor(
    create_class_levels_list(dir(levels)))

print('\n', levels_list, '\n\n', levels_dict, '\n')

#create hero
hero = character.Hero(10, 10, battle, control, compose_text, 6, 6, 6, 1, son,
                      levels_list, levels_dict, test_arg)

#start game
main_loop()
Ejemplo n.º 12
0
        self.control = control

    def main_loop(self):
        while True:

            self.control.control()

            if self.control.stage1_flag == True:
                if self.control.flag == 1:
                    self.control.k_space = False
                    self.control.flag = 0
                self.stage1.stage_loop()

            if self.control.stage2_flag == True:
                if self.control.flag == 0:
                    self.control.k_space = False
                    self.control.flag = 1
                self.stage2.stage_loop()

            pygame.display.update()


camera = camera.Camera(camera_config, level_width, level_height)
control = controller.Holy_Spirit()
view = classes.View_text(control)
hero = character.Hero(45, 45, control, view)
stage1 = level1.Level(control, hero, lev1, camera)
stage2 = level2.Level(control, hero, lev2)
game = main(stage1, stage2, control)
game.main_loop()