Sections
Timeline
Sub-Sections
Download
Unified Diff
Zip Archive
Metanav
Preferences
About Trac
Links
Slowchop Studios
Gerald Kaszuba
Advertisement

Changeset 37

Show
Ignore:
Timestamp:
16/03/08 23:12:08 (10 months ago)
Author:
gak
Message:
 
Location:
muckaround/freetower
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • muckaround/freetower/source/level.py

    r36 r37  
    3939    SECTION_SIZE = 10 
    4040 
    41     def __init__(self, levels, sections): 
     41    def __init__(self, game, levels, sections): 
     42        self.game = game 
    4243        self.levels = levels 
    4344        self.sections = sections 
     
    162163class LevelRenderable(Level): 
    163164 
    164     def __init__(self, levels, sections, video): 
    165         Level.__init__(self, levels, sections) 
    166         self.video = video 
     165    def __init__(self, game, levels, sections): 
     166        Level.__init__(self, game, levels, sections) 
     167        self.video = game.video 
    167168 
    168169    def render(self): 
  • muckaround/freetower/source/people.py

    r36 r37  
    11class Person(object): 
     2 
    23    def __init__(self, levelobj, level, section): 
    34        self.levelobj = levelobj 
    45        self.level = level 
    56        self.section = section 
    6         self.destination = None  # the current target destination 
     7 
     8        self.target = None  # the final destination 
     9        self.destination = None  # the short term destination (pathfinding) 
    710        self.path = None  # path saved for the destination 
    811 
     
    1114#        self.is_tired = False 
    1215 
     16        self.state = None 
     17 
     18    def think(self): 
     19        if not self.state: 
     20            self.think_of_something() 
     21 
     22    def think_of_something(self): 
     23        pass 
     24 
    1325class NormalPerson(Person): 
    1426    pass 
     27 
    1528 
    1629class ApartmentOwner(Person): 
  • muckaround/freetower/test.py

    r36 r37  
    99from source.structures import * 
    1010from source.transports import * 
     11from source.game import Game 
    1112 
    1213def main(): 
    13     video = Video() 
    14     video.init() 
    15     level = LevelRenderable(video=video, levels=50, sections=100) 
     14    game = Game() 
     15    game.init_video() 
     16    game.level = LevelRenderable(game, levels=50, sections=100) 
     17 
     18    level = game.level 
    1619 
    1720    for a in xrange(40): 
     
    2326 
    2427    level.set_section(3, 10, FoodStore) 
    25  
    2628    level.add_transport(Stairs, 0, 30, direction=1) 
    2729    level.add_transport(Lift, 0, 20, height=6) 
     
    2931    t = time.time() 
    3032    frames = 0 
    31     while not video.window.has_exit: 
     33    while not game.video.window.has_exit: 
     34        game.think(1) 
     35        game.input() 
     36        game.render() 
     37 
    3238        frames += 1 
    33         video.window.dispatch_events() 
    34         video.window.clear() 
    35         level.render() 
    36  
    37 #        meh = level.find_path( 
    38 #            TransportExit(None, level=0, section=0), 
    39 #            TransportExit(None, level=5, section=50), 
    40 #            maxcost=30 
    41 #            ) 
    42 #        print '\n'.join([repr(b) for b in meh]) 
    43  
    44         x, y = video.window._mouse_x, video.window._mouse_y 
    45         x = float(x) / Level.SECTION_SIZE 
    46         y = float(y) / Level.LEVEL_SIZE 
    47  
    48         glBegin(GL_LINES) 
    49         glVertex2f(0, 0) 
    50         glVertex2f(x, y) 
    51         glEnd() 
    52  
    53         video.flip() 
    54  
    5539        if frames % 100 == 0: 
    5640            print frames / (time.time() - t)