Hi just starting piglet and when I try and run this code it freezes but If I press a key on the keyboard it moves on a frame here's the code could somebody please help.
import pyglet
#from pyglet.window import key
a1 = 600
b1 = 300
t = 1
image1 = pyglet.resource.image("Aba2 Title.png")
image2 = pyglet.resource.image("picy.png")
sprite1 = pyglet.sprite.Sprite(image2, a1, b1)
window = pyglet.window.Window(1366, 768)
@window.event
def on_draw():
global a1
a1 = a1 + 2
window.clear()
image1.blit(0,0)
sprite1 = pyglet.sprite.Sprite(image2, a1, b1)
sprite1.draw()
if a1 >= 1300 :
a1 = 200
@window.event
def update(dt):
global a1
a1 = a1 + 2
@window.event
def main():
carryon = False
while not carryon :
global t
global a1
if a1 >= 1300 : t = 0
if t == 0 : carryon = True
on_draw()
global sprite1
a1 += 2
update()
pyglet.app.run()
main()I know there are errors but it runs but stops after one iteration and if I press a key on the keyboard it runs for another frame then stops . Thanks in advance for your help.
