コード例 #1
0
ファイル: helper.py プロジェクト: tannewt/celeste.py
def draw_time(x, y):
    s = game.seconds
    m = game.minutes % 60
    h = p8.flr(game.minutes / 60)

    p8.rectfill(x, y, x + 32, y + 6, 0)
    p8._print("{:02d}:{:02d}:{:02d}".format(h, m, s), x + 1, y + 1, 7)
コード例 #2
0
def load_room(x, y):
    has_dashed = False
    has_key = False

    # reset object list
    game.objects = p8.platform.Group(max_size=43)
    game.objects.x = 16

    # current room
    game.room.x = x
    game.room.y = y

    game.objects_by_type = {}

    # background map
    if p8.platform_id == "adafruit":
        game.objects.append(
            p8._map(game.room.x * 16, game.room.y * 16, 0, 0, 16, 16, 4))

    #off = -4 if game.is_title() else 0
    game.objects.append(
        p8._map(game.room.x * 16, game.room.y * 16, 0, 0, 16, 16, 2))

    # entities
    for tx in range(16):
        for ty in range(16):
            tile = p8.mget(game.room.x * 16 + tx, game.room.y * 16 + ty)
            if tile == 11 or tile == 12:
                direction = -1
                if tile == 12:
                    direction = 1
                p = Platform(x=tx * 8, y=ty * 8, direction=direction)
                game.objects.append(p)
                if Platform not in game.objects_by_type:
                    game.objects_by_type[Platform] = []
                game.objects_by_type[Platform].append(p)
            else:
                if tile in types:
                    t = types[tile]
                    o = t(x=tx * 8, y=ty * 8)
                    if t not in game.objects_by_type:
                        game.objects_by_type[t] = []
                    game.objects_by_type[t].append(o)
                    game.objects.append(o)

    if not game.is_title():
        game.objects.append(RoomTitle(x=0, y=0))
    elif p8.platform_id == "adafruit":
        # credits
        game.objects.append(p8._print("A+B", 58, 80, 5))
        game.objects.append(p8._print("MATT THORSON", 42, 96, 5))
        game.objects.append(p8._print("NOEL BERRY", 46, 102, 5))
コード例 #3
0
 def draw(self):
     self.spr=118+(frames/5)%3
     p8.spr(self.spr,self.x,self.y)
     if self.show:
         p8.rectfill(32,2,96,31,0)
         p8.spr(26,55,6)
         p8._print("x{}".format(self.score),64,9,7)
         draw_time(49,16)
         p8._print("deaths:{}".format(deaths),48,24,7)
     elif self.check(Player,0,0):
         p8.sfx(55)
         game.sfx_timer=30
         self.show=True
コード例 #4
0
ファイル: lifeup.py プロジェクト: tannewt/celeste.py
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.spd.y = -0.25
     self.duration = 30
     self.x -= 2
     self.y -= 4
     self.flash = 0
     self.solids = False
     if p8.platform_id == "adafruit":
         self._text = p8._print("1000", -2, 0, 7)
         self.append(self._text)
コード例 #5
0
    def draw(self):
        self.text="-- celeste mountain --#self memorial to those# perished on the climb"
        if self.check(Player,4,0):
            if self.index<len(self.text):
                self.index+=0.5
                if self.index>=self.last+1:
                    self.last+=1
                    p8.sfx(35)

            self.off=geom.Vec(x=8,y=96)
            for i in range(self.index):
                if self.text[i] != "#":
                    p8.rectfill(self.off.x-2,self.off.y-2,self.off.x+7,self.off.y+6 ,7)
                    p8._print(self.text[i],self.off.x,self.off.y,0)
                    self.off.x+=5
                else:
                    self.off.x=8
                    self.off.y+=7
        else:
            self.index=0
            self.last=0
コード例 #6
0
    def draw(self):
        self.delay-=1
        if self.delay<-30:
            game.objects.remove(self)
        elif self.delay<0:
            p8.rectfill(24,58,104,70,0)
            # rect(26,64-10,102,64+10,7)
            # print("---",31,64-2,13)
            if game.room.x==3 and game.room.y==1:
                p8._print("old site",48,62,7)
            elif game.level_index()==30:
                p8._print("summit",52,62,7)
            else:
                level=(1+game.level_index())*100
                p8._print(str(level) + " m",52+(level<1000 and 2 or 0),62,7)

            # p8._print("---",86,64-2,13)

            helper.draw_time(4,4)