Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- import sys
- from SharkLearn.Adventure import p1_level, p2_level, p3_level, p4_level, p5_level, p6_level, p7_level, p8_level, \
- p9_level, p10_level
- from SharkLearn.Classes2 import Trap, pl2, pl1, pl3, pl4, SizeAndPos, Position, start_pos
- # Player Selection
- player_selection = int(input("Select a player:\n\t1. jack\n\t2. Sharkbound\n\t3. Psuedo\n\t4. Anna\n> "))
- if player_selection == 1:
- player_level = p1_level
- player = pl1
- elif player_selection == 2:
- player_level = p2_level
- player = pl2
- elif player_selection == 3:
- player_level = p3_level
- player = pl3
- elif player_selection == 4:
- player_level = p4_level
- player = pl4
- else:
- print('Invalid Number')
- # Starting text and level
- print('You wake up in a dark room, with very faint torches on the walls, you stand up,'
- ' and walk through the door-frame in-front of you.....'
- )
- time.sleep(1)
- print(f'You are level {player_level}')
- # Controls
- print('\nThe controls are w (up), a (left), s (down), d (right) and /size (gets room size)\n')
- time.sleep(0.5)
- # Trap Code
- traps = (
- '\033[31;10m fell into a pit trap!',
- 'stepped onto a pressure plate, which shot down spikes from the ceiling!',
- 'activated a trip wire, which proceeded to shoot spikes from the walls',
- 'found a booby-trapped trapdoor, with explosives!'
- )
- escape_chance = (
- 1,
- 1,
- 0
- )
- trap = random.choice(traps)
- # Temperature
- temps = (
- 'cold',
- 'hot',
- 'cold',
- 'hot',
- 'cold',
- 'hot',
- 'freezing',
- 'boiling',
- )
- temp = random.choice(temps)
- # Brightness
- brights = (
- 'dim',
- 'dim',
- 'dim',
- 'dim',
- 'bright',
- 'bright',
- 'bright',
- 'just about see-able'
- )
- brightness = random.choice(brights)
- # Room Code
- trap_position = Trap(start_pos.size_of_room)
- def touch_wall():
- if player.position.x == start_pos.size_of_room + 1 or player.position.y == start_pos.size_of_room + 1:
- print('\nYou touched the spike walls, YOU LOSE!')
- sys.exit(15)
- if player.position.x == -1 or player.position.y == -1:
- print('\nYou touched the spike walls, YOU LOSE!')
- sys.exit(15)
- def touch_trap():
- if player.position.x == trap_position.x_pos_trap or player.position.y == trap_position.x_pos_trap:
- print(f'You {trap}')
- escape = random.choice(escape_chance)
- if escape == 0:
- print('But you escaped!')
- elif escape == 1:
- print('You died!')
- sys.exit(15)
- print(f'The room is {temp}, and {brightness}, and there might be a trap!')
- print(f'\nYou start in a room that is {start_pos.size_of_room} x {start_pos.size_of_room}, your starting position is x: '
- f'{start_pos.starting_x}, and y: {start_pos.starting_y}')
- in_room = True
- while in_room:
- w_a_s_d = input('Enter a control: ')
- if w_a_s_d == 'w':
- print(f'\nYou chose up')
- direction1 = 'w'
- elif w_a_s_d == 'a':
- print(f'\nYou chose left')
- direction1 = 'a'
- elif w_a_s_d == 's':
- print(f'\nYou chose down')
- direction1 = 's'
- elif w_a_s_d == 'd':
- print(f'\nYou chose right')
- direction1 = 'd'
- elif w_a_s_d == '/size':
- print(f'The room size is {start_pos.size_of_room} x {start_pos.size_of_room}.')
- continue
- else:
- print('\nInvalid Control')
- sys.exit(25)
- # if choosing
- if direction1 == 'w':
- player.position.move_up()
- touch_wall()
- touch_trap()
- print(f' You are now x: {player.position.x}, y: {player.position.y}')
- elif direction1 == 's':
- player.position.move_down()
- touch_wall()
- touch_trap()
- print(f' You are now x: {player.position.x}, y: {player.position.y}')
- elif direction1 == 'a':
- player.position.move_left()
- touch_wall()
- touch_trap()
- print(f' You are now x: {player.position.x}, y: {player.position.y}')
- elif direction1 == 'd':
- player.position.move_right()
- touch_wall()
- touch_trap()
- print(f' You are now x: {player.position.x}, y: {player.position.y}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement