Esempio n. 1
0
    def step(self):

        touch = core.singleTouch()
        if touch is not None:
            self.frame.position = vmath.vec3(touch['org_x'], touch['org_y'], 0)
            self.button.position = vmath.vec3(touch['cur_x'], touch['cur_y'],
                                              10)
        else:
            self.frame.position = vmath.vec3(0, 1000, 0)
            self.button.position = vmath.vec3(0, 1000, 10)
Esempio n. 2
0
camera = core.camera("cam01")
camera.orthographicProjection = True
camera.position = (0, 0, 100)

# what you want to draw should be registered in showcase
showcase = core.showcase("case01")
showcase.add(ship)

goal = vmath.vec2(0, 0)
pos = vmath.vec2(0, 0)
dir = vmath.vec2(0, 1)

loop = True
while loop:
    core.update()
    touch = core.singleTouch()
    if touch is not None:
        goal = vmath.vec2(touch['cur_x'], touch['cur_y'])

    d = goal - pos
    dist = vmath.length(d)
    d = vmath.normalize(d)
    r = vmath.dot(d, dir)
    if r < 0.98:
        n = vmath.cross(d, dir)
        if n > 0:
            rot = vmath.mat_rotation(-5.0 * core.getElapsedTime(), 2)
        else:
            rot = vmath.mat_rotation(5.0 * core.getElapsedTime(), 2)
        dir = rot * dir