@PYer/

Aliens Adventure Game

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
'''
@21natzil - "... awesome sci-fi text adventure, which has lost of replay value, as it changes every time!
'''















import sys, random, time
from replit import clear as c
class Room():
  def __init__(self): pass
  def play(self):
    print('This room hasnt been initialized yet.')

class Game_Over(Room):
  def play(self):
    time.sleep(5)
    a = [
      'My dog could do better than you.',
      'Wow. That was amazing.',
      'Hah! You are so bad.',
      'Your worse than your dad\'s jokes.',
      'You stink worse that a smelly goat.'
    ]
    print(random.choice(a))
    time.sleep(3)
    print('Game Over!')
    sys.exit()

class Win(Room):
  def play(self):
    time.sleep(5)
    a = [
      'Absolutely amazing!',
      'Your friends would be so proud.',
      'Terrific!',
      'Congrats!'
    ]
    print(random.choice(a))
    time.sleep(3)
    print('Game Over!')
    sys.exit()

class Intro(Room):
  def play(self):
    c()
    print('Welcome To Aliens Adventure Game!\nObjective: \n\tFind the bomb to be planted on Earth, \n\tPlace it on the bridge, and escape\n\tbefore the spaceship blows up.')
    if not input('Ready? [y/n]: ') == 'y': sys.exit()
    c()
    print('You are onboard an alien spaceship. You have managed to reach the main room, without spotting any aliens. Hopefully, this streak of good luck continues until you escape the ship. But as any good space invader knows, that is never the case. You look around the room deciding what to do when an alien pops out of a corridor. You put a hand on your blaster.\nYour options are:\n\t1. Shoot\n\t2. Tell A Joke\n\t3. Run')
    o = input('Move? [1, 2, 3]: ')
    c()
    if o == '1':
      print('You pull out your blaster and shoot the alien. Apparently the alien has enabled a force field as the bullet rebounds off of him. He is angered at your threating gesture,pulls out his own blaster, and shoots you in the head. You have determined the fate of thousands of inoccent people on earth.')
      return 'game over'
    elif o == '2':
      print('You remeber your old school training on the alien language. You say the first joke that pops in your mind:\n\tAyay anmay andyay ishay orsehay alkedway \n\tintoyay ayay arbay. Ouyay ouldway \n\tavehay oughtthay eythay ouldway avehay \n\tuckedday.\nThe alien doubles over laughing and you quickly rush past him and through the door into the corridor.')
      return 'corridor'
    elif o == '3':
      print('You quickly scan your surroundings, for an exit. You turn around and attempt to exit the way you came in, but the aline quickly pulss out his blaster and shoots your moving shape.  You have determined the fate of thousands of inoccent people on earth.')
      return 'game over'

class Corridor(Room):
  def play(self):
    print('You are running in the dark corridor. You reach the end and turn on your head light. You turn and see two doors in front of you. Which one will leader you to the bomb?\nYou can choose between the left one or the right one.\n\t1. Left\n\t2. Right')
    o = input('Room? [1, 2]: ')
    c()
    if o == '1':
      print('You enter the left room. There are no aliens in sight. Good. You turn off your head lamp since this room is lit. You take as step forward and you instantly know this is a mistake. The room turns dark, and the floor beneath you vaporizes, sending you out to space. You die due to lack of oxygen.')
      return 'game over'
    elif o == '2':
      return 'bomb hold'

class Bomb_Hold(Room):
  def play(self):
    print('You enter the right room. You see an artight compartment which probably holds the bomb. There is a keyboard for a password on top. Oh well, you cant hope for everything. There seems to be an unusual silence, to silent. You approach the keypad. You have six tries to guess the 1 digit password. Thats easy!')
    password = random.randint(0, 9)
    for _ in range(6):
      if input('[keypad]: ') == str(password):
        c()
        print('Bing! The airtight container opens and you hear a hissing sound. The bomb is visible inside submerged in water. You pick it up and then exit back in the corridor, and run across to the other end of the corrdior, where you see the bridge. Hopefully, you manage to place the bomb in the bridge and escape. You notice the timer for the bomb has already started, it reads [9:35]. 9 minutes, to escape.')
        return 'bridge'
      else:
        c()
        print('BEEEEEEEEEEEP. "Incorrect!" is displayed on the screen.')
    print('The airtight container shoots lasers out of all sides, and kill you. So close, yet so far.')
    return 'game over'

class Bridge(Room):
  def play(self):
    print('You enter the bridge. There are three aliens waiting with their blasters pulled out, aimed at you. You glance at the timer again [6:12]. You need to act fast. \nYour options are to:\n\t1. Place the bomb and run\n\t2. Run\n\t3. Place the bomb slowly.')
    o = input('Move? [1, 2, 3]: ')
    if o == '1':
      c()
      print('You place the bomb down, slow enough so that it doesnt explode, and turn around. You attempt to run back into the corridor to the main room when two aliens drop to there feet and enter a password to disabalize the bomb. The other aims his blaster and shoots you down! Running never works when the enemies have blasters.')
      return 'game over'
    elif o == '2':
      c()
      print('You keep a firm grip on the bomb and turn around. You attempt to escape the way you come in, but one of them shoots you with his blaster. In a few minutes they probably will have disarmed the bomb. Running never works when then enemies have blasters.')
      return 'game over'
    elif o == '3':
      c()
      print('You aim your blaster at the bomb, and the aliens raise their hands above their heads. You pause to think, and glance at the keypad. [6:00]. You blast the keypad in case it can be disabled, which is probable. There is no going back now. You set the bomb down slowly, keeping your gun trained on it. You slowly cross the room to the escape pods, where you hope to finally escape this dangerous spaceship. You remember something and take a second to blow up their blasters. The aliens begin to try and disarm the bomb. No need to worry. Hopefully. You exit into the escape pod room.')
      return 'escape room'

class EscapeRoom(Room):
  def play(self):
    print('You walk up to 4 escape pods, you know the clock is ticking and do not have time to check if any are damaged. Which pod do you choose.')
    p = input('Pod? [1, 2, 3, 4]: ')
    if int(p) == random.randint(1, 2) or int(p) == random.randint(3,4):
      c()
      print('You board pod number ' + p + '. You close the door behind you and hear a hissing sound. You press the eject button and shoot to Earth. You are ejected to Earth and thinking happy thoughts. Your own spaceship will probably come and retrieve you on Earth. The alien spaceship blows up behind you, making a beutiful sight in the sky. You have suceeded and will live to thwart the aliens another day.')
      return 'win'
    else:
      c()
      print('You board pod number ' + p +'. You are thinking happy thoughts, when the hull ruptures squishing your now dead body. Sooooooooooooooooooooo close, yet sooooooooooooooooooooooooooooooooooooo far.')
      return 'game over'

engine = {
  'game over': Game_Over(),
  'intro': Intro(),
  'corridor': Corridor(),
  'bomb hold': Bomb_Hold(),
  'bridge': Bridge(),
  'escape room': EscapeRoom(),
  'win': Win()
}

room = engine['intro'].play()
while True:
  room = engine[room]
  room = room.play()