Ejemplo n.º 1
0
    def __init__(self):
        (self.window, self.canvas) = glucosa.create_window()
        self.events = glucosa.Events(self.canvas)
        self.sprites = []
        self._create_keyboard_view()

        self.events.connect("key-pressed", self.on_key_down)
        self.events.connect("key-released", self.on_key_up)
    def __init__(self):
        (self.window, self.canvas) = glucosa.create_window()

        image = glucosa.Image('../data/aceituna.png')
        self.sprite = glucosa.Sprite(image, 0, 0, 18, 18, scale=2)
        self.canvas.add_sprite(self.sprite)
        self.events = glucosa.Events(self.canvas)
        self.events.connect('mouse-moved', self.move_sprite)
Ejemplo n.º 3
0
    def __init__(self):
        (self.window, self.canvas) = glucosa.create_window()
        self.canvas.connect('draw', self.on_draw)

        image = glucosa.Image('../data/aceituna.png')
        self.events = glucosa.Events(self.canvas)
        self.events.connect('mouse-moved', self.when_move_mouse)
        self.lapiz = glucosa.Pencil()

        self.mouse_x = 0
        self.mouse_y = 0
 def __init__(self):
     (self.window, self.canvas) = glucosa.create_window()
     self.canvas.connect('update', self.on_update)
     self.canvas.set_update_loop(60)
     
     image = glucosa.Image('../data/aceituna.png')
     self.sprite = glucosa.Sprite(image, 100, 100, 18, 18, scale=2)
     self.canvas.add_sprite(self.sprite)
     self.events = glucosa.Events(self.canvas)
     self.events.connect('mouse-scroll-up', self.rueda_del_raton_arriba)
     self.events.connect('mouse-scroll-down', self.rueda_del_raton_abajo)
Ejemplo n.º 5
0
 def __init__(self):
     (self.window, self.canvas) = glucosa.create_window()
     
     image = glucosa.Image('../data/aceituna.png')
     self.sprite = glucosa.Sprite(image, 100, 100, 18, 18, scale=2)
     self.canvas.add_sprite(self.sprite)
     self.events = glucosa.Events(self.canvas)
     self.events.connect('mouse-button-pressed', self.mouse_button_press)
     self.events.connect('mouse-button-released', self.mouse_button_release)
     self.events.connect('mouse-moved', self.move_sprite)
     self._pressed = False
Ejemplo n.º 6
0
    def __init__(self):
        (self.window, self.canvas) = glucosa.create_window()
        self.window.resize(640, 480)

        self.canvas.set_update_loop(60)
        self.canvas.set_background(glucosa.Image('../data/space.png'))
        self.ship = Ship(self, 300, 380)

        self.enemies = []
        gobject.timeout_add(1000, self._create_enemy)
        self._create_stars()
Ejemplo n.º 7
0
    def __init__(self):
        (self.window, self.canvas) = glucosa.create_window()
        self.window.resize(640, 480)

        self.canvas.set_update_loop(60)
        self.canvas.set_background(glucosa.Image('../data/pasto.png'))
        self.player = Player(self, 320, 240)

        # Llama a la funcion _tick una vez por segundo, para
        # crear frutas.
        gobject.timeout_add(1000, self._tick)

        self.fruits = []
Ejemplo n.º 8
0
    def __init__(self):
        (self.window, self.canvas) = glucosa.create_window()
        self.canvas.connect('update', self.on_update)
        self.canvas.connect('draw', self.on_draw)

        image = glucosa.Image('../data/aceituna.png')
        self.sprite = glucosa.Sprite(image, 0, 0, 18, 18, type_collision=glucosa.Sprite.COLLISION_CIRCLE)
        self.events = glucosa.Events(self.canvas)
        self.events.connect('mouse-moved', self.move_sprite)

        self.sprite2 = glucosa.Sprite(image, 60, 40, 18, 18, type_collision=glucosa.Sprite.COLLISION_CIRCLE)
        self.texto_colision = glucosa.Text('', 10, 100, face='Arial', size=18,
                                           color = (255, 0, 0))

        self.canvas.add_sprite(self.sprite)
        self.canvas.add_sprite(self.sprite2)
Ejemplo n.º 9
0
    def __init__(self):
        (self.window, self.canvas) = glucosa.create_window()

        self.canvas.set_update_loop(60)
        self.actores = []

        self.actor_animado = glucosa.Sprite(glucosa.Frame('../data/moneda.png', 8), 0, 0)
        self.canvas.add_sprite(self.actor_animado)
        self.actor_animado.x = 100
        self.actor_animado.y = 60

        self.events = glucosa.Events(self.canvas)

        self.events.connect('key-pressed', self.tecla_pulsada)
	self.events.connect('mouse-button-pressed', self.boton_mouse_presionado)

        self.sound = glucosa.Sound("data/jump.wav")
        self.sound.play()
Ejemplo n.º 10
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.path.append("..")

import glucosa


(window, canvas) = glucosa.create_window()
image = glucosa.Image('../data/aceituna.png')
sprite = glucosa.Sprite(image, 0, 0, 18, 18, type_collision=glucosa.Sprite.COLLISION_CIRCLE)

arriba = sprite.get_top()
abajo = sprite.get_bottom()

sprite.set_top(arriba - 100)

assert sprite.get_top() == arriba - 100
assert sprite.get_bottom() == abajo - 100

sprite.left = 0
assert sprite.right == 37

sprite.left = -100
assert sprite.right == -100 + 37
Ejemplo n.º 11
0
    def __init__(self):
        (self.window, self.canvas) = glucosa.create_window()
        self.window.resize(640, 480)

        self.canvas.set_update_loop(60)
        self.ship = Ship(self, 300, 380)
 def __init__(self):
     (self.window, self.canvas) = glucosa.create_window()
     self.events = glucosa.Events(self.canvas)
     self.sprites = []
     self._create_player()