España (Español)
Canada (English)
Canada (Français)
Deutschland (Deutsch)
España (Español)
France (Français)
Italia (Italia)
United Kingdom (English)
United States (English)
日本 (日本語)
Foros
Hola:
Visitante
Iniciar sesión
Inicio
Guía de inicio rápido
Noticias
Suscripción
Juegos
Catálogo de juegos
Enviar juego
Revisar juego
Probar juego
Creadores
Mi perfil
Mi empresa
Comunidad
Foros
Temas destacados en la comunidad
Recursos de la comunidad
Educación
Introducción
Catálogo de contenido sobre educación
Packs de inicio
Utilidades
Recursos
Preguntas más frecuentes
Socios
Descargar
Comentarios
Sitio de prensa
foros de la comunidad
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 07/11/2009 16:52 by
JasonD
. 4 replies.
07/11/2009 6:54
venator
(2)
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?
07/11/2009 6:59
In reply to
JasonD
(811)
Posts
702
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
Duality ZF
[
Top 20 in Dream.Build.Play 2009
]
07/11/2009 7:10
In reply to
venator
(2)
Posts
2
Re: Making the sprite's image turn by an angle
Reply
Quote
Thanks can someone tell me the exact syntax please.
07/11/2009 7:28
In reply to
Craig Martin
(3955)
Posts
2.606
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
07/11/2009 16:52
In reply to
JasonD
(811)
Posts
702
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
Duality ZF
[
Top 20 in Dream.Build.Play 2009
]
Page 1 of 1 (5 items)
Previous
Next
© 2009 Microsoft Corporation. Reservados todos los derechos.
Condiciones de uso
Declaración de privacidad
Código de conducta
Comentarios