Beispiel #1
0
 def update(self):
     u'''
     なにかキーが押されたらkey_mode=True。このとき、マウス操作は利かない
     マウス座標が前と変わったら、key_mode=False
     '''
     if not self.pre_mouse_point == self.get_mouse_point(): self.key_mode = False
     if 'mouse' in self.interfaces and not self.key_mode: 
         self.point = self.get_mouse_point()
         if self.in_map():
             Mouse.hide_cursor()
         else: 
             Mouse.show_cursor()
     if 'key' in self.interfaces:
         if Key.is_press(K_UP):
             self.press_counter[0] += 1
             self.key_mode = True
         elif Key.is_press(K_DOWN):
             self.press_counter[1] += 1
             self.key_mode = True
         if Key.is_press(K_LEFT):
             self.press_counter[2] += 1
             self.key_mode = True
         elif Key.is_press(K_RIGHT):
             self.press_counter[3] += 1
             self.key_mode = True
     if 'pad' in self.interfaces:
         if self.joy.get_count() == 1: id = 0
         else: id = self.number
         axes = self.joy.sticks[id].get_numaxes() >= 2
         pad = self.joy.sticks[id]
         if pad.get_button(0) or (axes and pad.get_axis(1) < -0.5):
             self.press_counter[0] += 1
             self.key_mode = True
         if pad.get_button(1) or (axes and pad.get_axis(1) > 0.5):
             self.press_counter[1] += 1
             self.key_mode = True
         if pad.get_button(2) or (axes and pad.get_axis(0) < -0.5):
             self.press_counter[2] += 1
             self.key_mode = True
         if pad.get_button(3) or (axes and pad.get_axis(0) > 0.5):
             self.press_counter[3] += 1
             self.key_mode = True
     if self.press_counter[0] > 2:
         self.press_counter[0] = 0
         self.point.y -= 1
     if self.press_counter[1] > 2:
         self.press_counter[1] = 0
         self.point.y += 1
     if self.press_counter[2] > 2:
         self.press_counter[2] = 0
         self.point.x -= 1
     if self.press_counter[3] > 2:
         self.press_counter[3] = 0
         self.point.x += 1
     if self.point.x < 0: self.point.x = 0
     elif self.point.x > settings.STAGE_WIDTH-2: self.point.x = settings.STAGE_WIDTH-2
     if self.point.y < 0: self.point.y =0
     elif self.point.y > settings.STAGE_HEIGHT-2: self.point.y = settings.STAGE_HEIGHT-2
     self.move_pointer()
     self.pre_mouse_point = self.get_mouse_point()
Beispiel #2
0
 def ready(self, *args, **kwargs):
     super(LogoScene, self).ready()
     self.background = Image("../resources/image/menu/whiteback.png",
                             alpha=False)
     self.logo = Image("../resources/image/menu/kawaz.png", alpha=False)
     self.logo.x = 340
     self.logo.y = 230
     self.sprites.add(self.background)
     self.sprites.add(self.logo)
     self.timer = Timer(210)
     self.mouse = Mouse(0)
     self.joypads = []
     for i in xrange(0, JoyPad.get_num_joypads()):
         self.joypads.append(JoyPad(i))
Beispiel #3
0
class LogoScene(Scene):
    BACKGROUND = (255, 255, 255)

    def ready(self, *args, **kwargs):
        super(LogoScene, self).ready()
        self.background = Image("../resources/image/menu/whiteback.png",
                                alpha=False)
        self.logo = Image("../resources/image/menu/kawaz.png", alpha=False)
        self.logo.x = 340
        self.logo.y = 230
        self.sprites.add(self.background)
        self.sprites.add(self.logo)
        self.timer = Timer(210)
        self.mouse = Mouse(0)
        self.joypads = []
        for i in xrange(0, JoyPad.get_num_joypads()):
            self.joypads.append(JoyPad(i))

    def update(self):
        self.timer.tick()
        self.timer.play()
        skip = self.mouse.is_press(Mouse.LEFT)
        for joypad in self.joypads:
            skip |= joypad.is_press(4)
        if self.timer.is_over() or skip:
            Game.get_scene_manager().change_scene('mainmenu')
        elif self.timer.now < 60:
            self.logo.alpha = 255 * self.timer.now / 60
        elif 120 < self.timer.now:
            self.logo.alpha = 255 * (180 - self.timer.now) / 60
Beispiel #4
0
class LogoScene(Scene):
    BACKGROUND = (255,255,255)
    def ready(self, *args, **kwargs):
        super(LogoScene, self).ready()
        self.background = Image("../resources/image/menu/whiteback.png", alpha=False)
        self.logo = Image("../resources/image/menu/kawaz.png", alpha=False)
        self.logo.x = 340
        self.logo.y = 230
        self.sprites.add(self.background)
        self.sprites.add(self.logo)
        self.timer = Timer(210)
        self.mouse = Mouse(0)
        self.joypads = [] 
        for i in xrange(0, JoyPad.get_num_joypads()):
            self.joypads.append(JoyPad(i))        
    def update(self):
        self.timer.tick()
        self.timer.play()
        skip = self.mouse.is_press(Mouse.LEFT)
        for joypad in self.joypads:
            skip |= joypad.is_press(4)
        if self.timer.is_over() or skip:
            Game.get_scene_manager().change_scene('mainmenu')
        elif self.timer.now < 60:
            self.logo.alpha = 255*self.timer.now/60
        elif 120 < self.timer.now:
            self.logo.alpha = 255*(180-self.timer.now)/60
Beispiel #5
0
 def poll(self):
     if 'mouse' in self.interfaces and not self.key_mode:
         if Mouse.is_press('LEFT') and not self.pressed:
             self.pressed = True
             return 1
         elif Mouse.is_press('RIGHT') and not self.pressed:
             self.pressed = True
             return -1
         if Mouse.is_release(self):
             self.pressed = False
     if 'key' in self.interfaces:
         if Key.is_press(K_x): 
             if not self.press_counter[4]:
                 self.press_counter[4] = 1
                 self.key_mode = True
                 return -1
         elif Key.is_press(K_z):
             if not self.press_counter[5]: 
                 self.press_counter[5] = 1
                 self.key_mode = True
                 return 1
         else:
             self.press_counter[4] = 0
             self.press_counter[5] = 0
     if 'pad' in self.interfaces:
         if self.joy.get_count() == 1: id = 0
         else: id = self.number
         if self.joy.sticks[id].get_numbuttons >= 13:
             left = 12
             right = 11
         else:
             left = 5
             right = 6
         pad = self.joy.sticks[id]
         if pad.get_button(left):
             if not self.press_counter[4]:
                 self.press_counter[4] = 1
                 return -1
         elif pad.get_button(right):
             if not self.press_counter[5]: 
                 self.press_counter[5] = 1
                 return 1
         else:
             self.press_counter[4] = 0
             self.press_counter[5] = 0
     return 0
Beispiel #6
0
 def update(self):
     self.timer.tick()
     self.timer.play()
     if self.timer.is_over() or Mouse.is_press("LEFT") or Key.is_press(K_RETURN):
         Game.get_scene_manager().change_scene("mainmenu")
     elif self.timer.now < 60:
         self.logo.alpha = 255 * self.timer.now / 60
     elif 120 < self.timer.now:
         self.logo.alpha = 255 * (180 - self.timer.now) / 60
Beispiel #7
0
 def update(self):
     self.timer.tick()
     self.timer.play()
     if self.timer.is_over() or Mouse.is_press('LEFT'):
         Game.get_scene_manager().change_scene('title')
     elif self.timer.now < 60:
         self.logo.alpha = 255*self.timer.now/60
     elif 120 < self.timer.now:
         self.logo.alpha = 255*(180-self.timer.now)/60
Beispiel #8
0
 def ready(self, *args, **kwargs):
     super(LogoScene, self).ready()
     self.background = Image("../resources/image/menu/whiteback.png", alpha=False)
     self.logo = Image("../resources/image/menu/kawaz.png", alpha=False)
     self.logo.x = 340
     self.logo.y = 230
     self.sprites.add(self.background)
     self.sprites.add(self.logo)
     self.timer = Timer(210)
     self.mouse = Mouse(0)
     self.joypads = [] 
     for i in xrange(0, JoyPad.get_num_joypads()):
         self.joypads.append(JoyPad(i))        
Beispiel #9
0
 def get_mouse_point(self):
     return global_to_local(Mouse.get_pos())
Beispiel #10
0
 def ready(self, *args, **kwargs):
     Mouse.show_cursor()
     self.bgm.change(u'../resources/bgm/result_intro.wav', -1, u'../resources/bgm/result_loop.wav', 500)
     self.window.ready()
     self.draw()
     self.bgm.play()
Beispiel #11
0
 def ready(self, *args, **kwargs):
     BGM.set_volume(0.4)
     self.press = True
     Mouse.show_cursor()
     self.string = Animation(u'../resources/image/main/strings.png',AnimationInfo(3,0,0,360,210,0),x=220, y=195)
     self.sprites.add(self.string)