8 Queens (pyglet-python)
<p>I'm trying to make 8 queens game on pyglet. I have succesfully generated board.png on window. Now when I paste queen.png image on it, I want it to show only queen on it not the white part. I removed white part using photoshop, but as I call it on board.png in pyglet it again shows that white part please help.</p>

<pre><code>import pyglet
from pyglet.window import Window, mouse, gl

# Display an image in the application window
image = pyglet.image.Texture.create(800,800)
board = pyglet.image.load('resources/Board.png')
queen = pyglet.image.load('resources/QUEEN.png')
image.blit_into(board,0,0,0)
image.blit_into(queen,128,0,0)

# creating a window
width = board.width
height = board.height
mygame = Window(width, height,
                resizable=False,
                caption="8 Queens",
                config=pyglet.gl.Config(double_buffer=True),
                vsync=False)

# Making list of tiles
print("Height: ", board.height, "\nWidth: ", board.width)


@mygame.event
def on_draw():
    mygame.clear()
    image.blit(0, 0)


def updated(dt):
    on_draw()


pyglet.clock.schedule_interval(updated, 1 / 60)

# Launch the application
pyglet.app.run()
</code></pre>

<p>These are the images:</p>

<p><a href="http://i.stack.imgur.com/sAMZd.png" rel="nofollow">queen.png</a></p>

<p><a href="http://i.stack.imgur.com/5hZDI.png" rel="nofollow">board.png</a></p>

<p>Your image is a rectangle. So necessarily, you will have a white space around your queen whatever you do. </p>

<p>I would recommend a bit of hacking (it's not very beautiful) and create two queen versions: queen_yellow and queen_black. Whenever the queen is standing on a yellow tile, display queen_yellow, and otherwise display queen_black.</p>

<p>To find out whether a tile is a yellow tile (using a matrix with x and y coordinates, where the top value for y is 0 and the very left value for x is 0): </p>

<pre><code>if tile_y%2=0: #is it an even row?
    if tile_x%2=0: #is it an even column?
        queentype = queen_yellow
    else:
        queentype = queen_black
else: #is it an uneven row?
    if tile_x%2!=0: #is it an uneven column?
        queentype = queen_yellow
    else: queentype = queen_black
</code></pre>

<p>Hope that helped,
Narusan</p>

python pyglet