Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @window.event
- def on_draw():
- global vertex_list,pill
- window.clear()
- i = 30
- vertex_list.draw(pyglet.gl.GL_LINES)
- batch2.draw()
- #for p in pills:
- # p.draw()
- batch.draw()
- import pyglet, random
- class Pill():
- def __init__(self,x,y,batch):
- print("creating a pill with coords " ,x,y)
- self.size = 3
- self.vel = [0,0]
- self.x = -1000
- self.y = -1000
- r = random.randrange(255)
- g = random.randrange(255)
- b = random.randrange(255)
- vertices = [self.x,self.y,self.x +self.size,self.y,self.x +self.size*2,self.y +self.size,self.x+self.size,self.y+self.size*2,self.x,self.y+self.size*2,self.x-self.size,self.y+self.size,self.x,self.y]
- colours = [r,g,b,r,g,b,r,g,b,r,g,b,r,g,b,r,g,b,r,g,b]
- self.position_on_map_x = x
- self.position_on_map_y = y
- self.rotation = 0
- #self.vertex_list = pyglet.graphics.vertex_list(7,("v2f",vertices),("c3b",colours))
- self.vertex_list = batch.add(7,pyglet.gl.GL_POLYGON,None,("v2f",vertices),("c3b",colours))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement