finding left/top of a rect, for a sprite?

This is the place for queries that don't fit in any of the other categories.

finding left/top of a rect, for a sprite?

Postby zoomer428 » Sun Sep 18, 2016 9:34 pm

So this probably wont require posting any code but essentially I have a sprite sheet I'm using and I cant figure out what the left/top should be for each sprite. finding the width and height are easy but like I said, left and top not so much. I don't completely know what left and top are however I have an idea as ive been tinkering with finding the left and top of my sprites/rectangles but I know there has to be a better way than guessing until your sprite fits inside the rectangle. ill post the code for the rect but its pretty basic stuff I just don't know how to calculate the left and top for my sprite, hopefully you can understand my question, thanks for the help. oh and if it helps I'm using these in pygame and pyganim for the sprite sheets.
Code: Select all
top = 15
width = 38
height = width
rects = [(0, top, width, height),
         (32, top, width, height),
         (64, top, width, height),
         (128, top, width, height),
         (158, top, width, height),
         (191, top, width, height),
         (222, top, width, height),]
zoomer428
 
Posts: 2
Joined: Fri Sep 16, 2016 7:45 pm

Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot] and 8 guests