Wrox Programmer Forums
|
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
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2007, 10:38 AM
Registered User
 
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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)
            if (paddlePosition < 0.05f)
                paddlePosition = 0.05f;

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?



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

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

 
Old July 22nd, 2007, 07:15 AM
Registered User
 
Join Date: May 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.






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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.