Wrox Programmer Forums Size of sprites in spritesheets
 | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6
 This is the forum to discuss the Wrox book Professional XNA Game Programming: For Xbox 360 and Windows by Benjamin Nitschke; ISBN: 9780470126776 Read more about Professional XNA Game Programming: For Xbox 360 and Windows or buy the book from your favorite retailer Download the code for Professional XNA Game Programming: For Xbox 360 and Windows
 Welcome to the p2p.wrox.com Forums. You are currently viewing the BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersâ€™ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
July 19th, 2007, 10:38 AM
 Registered User Join Date: May 2007 Location: , , Germany. Posts: 2 Thanks: 0 Thanked 0 Times in 0 Posts
Size of sprites in spritesheets

How do I figure out the position and size of a single sprite in a sprite sheet?
In the book (breakout game chapter 3) ben writes this

GamePaddleRect = new Rectangle(39, 1, 93, 23),
GameBallRect = new Rectangle(1, 1, 36, 36),
GameBlockRect = new Rectangle(136, 1, 62, 27),
GameYouWonRect = new Rectangle(2, 39, 92, 21),
GameYouLostRect = new Rectangle(105, 39, 94, 21);

// Make sure paddle stay between 0 and 1 (offset 0.05f for paddle width)

Ok, now ive got the coordinates out of the code and i can use them.
But how can I get these values out of the image itself?
Is there a program for this, or do you just know them if you created the spritesheet yourself?

July 19th, 2007, 03:53 PM
 Registered User Join Date: Jul 2007 Location: , , . Posts: 2 Thanks: 0 Thanked 0 Times in 0 Posts

i was JUST asking myself this very question.. hopefully we can both get an answer.

July 22nd, 2007, 07:15 AM
 Registered User Join Date: May 2007 Location: franklin, MA, USA. Posts: 6 Thanks: 0 Thanked 0 Times in 0 Posts

If you have Photoshop, you can get the information in the info panel by selecting the area with the marquee tool. You should set your ruler grid to pixels. You could also do it by trial and error. Once you have the dimensions for the ball, the images are laid out in a rectangular array, so you have the "Y" dimension for the first row, and the starting X coordiante for the next item.

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Size of text box depending on size of another box AstridVM BOOK: Access 2003 VBA Programmer's Reference 0 March 7th, 2007 06:24 AM size of the array mafia boy Java Basics 6 April 24th, 2006 07:41 PM table size silvia C# 2 February 10th, 2006 04:12 AM Output Size aspadda Excel VBA 2 April 3rd, 2004 06:42 PM DB Size acko SQL Server 2000 2 March 8th, 2004 05:21 PM

All times are GMT -4. The time now is 08:45 AM.