United States (English)
Canada (English)
Canada (Français)
Deutschland (Deutsch)
España (Español)
France (Français)
Italia (Italia)
United Kingdom (English)
United States (English)
日本 (日本語)
Forums
Hi,
Visitor
Sign In
Home
Quick Start Guide
News
Membership
Games
Games Catalog
Submit Game
Review Game
Playtest Game
Creators
My Profile
My Business
Community
Forums
Community Spotlight
Community Resources
Education
Getting Started
Education Catalog
Starter Kits
Utilities
Academia
Developer Talk Series
Resources
FAQ
Partners
Download
Feedback
Press Site
Meet the Team
community forums
XNA Community Forums
»
XNA Game Studio Technologies (Xbox 360, Zune, and Windows)
»
General
»
Making the sprite's image turn by an angle
More Search Options
|
My Discussions
|
Active Topics
|
Not Read
Page 1 of 1 (5 items)
Sort Posts:
Oldest to newest
Newest to oldest
Previous
Next
Making the sprite's image turn by an angle
Last post 11/7/2009 4:52 PM by
JasonD
. 4 replies.
11/7/2009 6:54 AM
venator
(0)
Posts
2
Making the sprite's image turn by an angle
Reply
Quote
I'm making a version of the game Tank and I am using the mouse to set the angle of my turret. The problem is that I don't know how to make the turret turn to the angle so it looks in the right direction. How do I make the turret spin? Do I have to make many pictures of the turrets multiple positions?
11/7/2009 6:59 AM
In reply to
JasonD
(861)
Posts
730
Re: Making the sprite's image turn by an angle
Reply
Quote
No, just use SpriteBatch.Draw() with a rotation != 0.
Jason Doucette
/
Xona Games
-
Decimation X
-- FRIENDS SCOREBOARDS update in
Playtest!
-
Duality ZF
11/7/2009 7:10 AM
In reply to
venator
(0)
Posts
2
Re: Making the sprite's image turn by an angle
Reply
Quote
Thanks can someone tell me the exact syntax please.
11/7/2009 7:28 AM
In reply to
Craig Martin
(7227)
Posts
3,647
Re: Making the sprite's image turn by an angle
Reply
Quote
Use one of these 3 overloads:
public
void
Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle? sourceRectangle, Color color,
float
rotation
, Vector2 origin, SpriteEffects effects,
float
layerDepth);
public
void
Draw(Texture2D texture, Vector2 position, Rectangle? sourceRectangle, Color color,
float
rotation
, Vector2 origin,
float
scale, SpriteEffects effects,
float
layerDepth);
public
void
Draw(Texture2D texture, Vector2 position, Rectangle? sourceRectangle, Color color,
float
rotation
, Vector2 origin, Vector2 scale, SpriteEffects effects,
float
layerDepth);
Game hobbyist hell-bent on coding a diabolical Matrix
11/7/2009 4:52 PM
In reply to
JasonD
(861)
Posts
730
Re: Making the sprite's image turn by an angle
Reply
Quote
venator:
Thanks can someone tell me the exact syntax please.
Type SpriteBatch.Draw() and cursor over the Draw, and press F1 or F12. The best way to learn is to look up the details from MSDN yourself. It's a good habit to get used to.
Jason Doucette
/
Xona Games
-
Decimation X
-- FRIENDS SCOREBOARDS update in
Playtest!
-
Duality ZF
Page 1 of 1 (5 items)
Previous
Next
© 2010 Microsoft Corporation. All rights reserved.
Terms of Use
Privacy Statement
Code of Conduct
Feedback