Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
 def draw(self):
     self.x += self.spd
     self.y += math.sin(self.off)
     self.off+= min(0.05,self.spd/32)
     p8.rectfill(self.x,self.y,self.x+self.s,self.y+self.s,self.c)
     if self.x>128+4:
         self.x=-4
         self.y=p8.rnd(128)
Ejemplo n.º 3
0
 def draw(self):
     self.x += self.spd.x
     self.y += self.spd.y
     self.t -= 1
     if self.t <= 0:
         game.dead_particles.remove(self)
     p8.rectfill(self.x - self.t / 5, self.y - self.t / 5,
                 self.x + self.t / 5, self.y + self.t / 5, 14 + self.t % 2)
Ejemplo n.º 4
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
Ejemplo n.º 5
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)
Ejemplo n.º 6
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
Ejemplo n.º 7
0
 def draw(self):
     self.x += self.spd
     p8.rectfill(self.x,self.y,self.x+self.w,self.y+4+(1-self.w/64)*12,14 if game.new_bg else 1)
     if self.x > 128:
         self.x = -self.w
         self.y=p8.rnd(128-8)
Ejemplo n.º 8
0
def _draw():
    if game.freeze > 0:
        return

    # reset all palette values
    p8.pal()

    # start game flash
    if game.start_game:
        c = 10
        if game.start_game_flash > 10:
            if game.frames % 10 < 5:
                c = 7
        elif game.start_game_flash > 5:
            c = 2
        elif game.start_game_flash > 0:
            c = 1
        else:
            c = 0

        if c < 10:
            p8.pal(6, c)
            p8.pal(12, c)
            p8.pal(13, c)
            p8.pal(5, c)
            p8.pal(1, c)
            p8.pal(7, c)

    # clear screen
    bg_col = 0
    if game.flash_bg:
        bg_col = game.frames / 5
    elif game.new_bg:
        bg_col = 2
    p8.rectfill(0, 0, 128, 128, bg_col)

    display.show(game.objects)

    # clouds
    if not game.is_title():
        for c in clouds:
            c.draw()

    # draw bg terrain
    # if p8.platform == "adafruit":
    #     game.objects.append(p8._map(game.room.x * 16,game.room.y * 16,0,0,16,16,4))
    # else:
    #     p8._map(game.room.x * 16,game.room.y * 16,0,0,16,16,0)

    # platforms/big chest
    for o in game.objects:
        if isinstance(o, Platform) or isinstance(o, BigChest):
            o.draw()

    # draw terrain
    # off = -4 if game.is_title() else 0
    # if p8.platform == "adafruit":
    #     p8._map(game.room.x*16,game.room.y * 16,off,0,16,16,2)

    # draw objects
    for o in game.objects:
        if not isinstance(o, Platform) and not isinstance(o, BigChest):
            try:
                o.draw()
            except AttributeError:
                pass

    # draw fg terrain
    # if p8.platform != "gb" and platform != "gbc":
    #     p8._map(game.room.x * 16,game.room.y * 16,0,0,16,16,8)

    # particles
    for p in particles:
        p.draw()

    # dead particles
    for p in game.dead_particles:
        p.draw()

    # draw outside of the screen for screenshake
    p8.rectfill(-5, -5, -1, 133, 0)
    p8.rectfill(-5, -5, 133, -1, 0)
    p8.rectfill(-5, 128, 133, 133, 0)
    p8.rectfill(128, -5, 133, 133, 0)

    if game.level_index() == 30:
        p = None
        for o in game.objects:
            if isinstance(o, Player):
                p = o
                break
        if p:
            diff = min(24, 40 - abs(p.x + 4 - 64))
            rectfill(0, 0, diff, 128, 0)
            rectfill(128 - diff, 0, 128, 128, 0)