while trying to make my game, I noticed that you can't change the anchor point of sprites in pyglet.
I use some convoluted way (see bottom of the post) to draw my minimap (WIP) so that the rooms are centered and lined-up correctly, however, I thought of the following occurrence.
I'll be using the mouse pointer to direct a 2D person from the top. However, if the anchor point of a sprite is the bottom-left corner of the original image, how can you make it feel as though the anchor point is in the middle of the sprite?
This may not be so important for the player, but it would be hell to algorithmically control the NPC's that fight.
Any help and input appreciated.
Code:
pic_img = image.load(imgPath)
picX, picY = window.width/2,window.height/2
pic = pyglet.sprite.Sprite(pic_img, x=picX, y=picY)
pic.rotation = roomType.ImageRotation
if pic.rotation == 0:
picX = picX - pic.width / 2
picY = picY - pic.height / 2
elif pic.rotation == 90:
picX = picX - pic.width / 2
picY = picY + pic.height / 2
elif pic.rotation == 180:
picX = picX + pic.width / 2
picY = picY + pic.height / 2
elif pic.rotation == 270 or pic.rotation == -90:
picX = picX + pic.width / 2
picY = picY - pic.height / 2
pic.x,pic.y = picX, picY