This repository was archived by the owner on Jul 1, 2026. It is now read-only.
forked from jcrawfordobanner/FinalProj
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.py
More file actions
43 lines (36 loc) · 1.28 KB
/
Copy pathmodel.py
File metadata and controls
43 lines (36 loc) · 1.28 KB
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
from classes import *
import narrative
import pygame
from pygame.locals import*
import time
class SpaceGameModel(object):
"""Model of the game"""
def __init__(self, size, rooms, doors,puzzles):
self.allrooms = rooms #dictionary of all rooms
self.room = self.allrooms["startRoom"]
self.inventor = Inventory()
self.messages = narrative.messages
self.textbox= Textbox(size, self.messages['game_intro'])
self.doors = doors
self.puzzles=puzzles
self.choices=0
def draw(self, scrn):
self.room.draw(scrn)
self.textbox.draw(scrn)
def get_clicked(self, pos):
clicked_item = False
for item in self.room.items:
if item.click(pos):
clicked_item = item.click(pos)
return clicked_item
def update(self, pos, words = None):
"""Changes the model based upon new information"""
if words:
self.textbox.update(words)
for key in self.allrooms:
self.allrooms[key].update(pos)
for item in self.room.items:
if item.hidd and item.take:
self.inventor.add_item(item)
# if self.get_clicked(pos) in self.doors:
# self.room = self.allrooms[self.doors.get(self.get_clicked(pos))]