Friday, October 28, 2005

Got the player's ship on the screen!

Today, I fixed a pretty stumping problem. You'll never guess how I did it. I read the manual. Can you believe that? I am a male man, and I read the manual! So, I was having a real hard time getting my ship to show up on screen. I thought I had thoroughly examined my example code, but I missed two lines somewhere.

Here's what I had to begin:

//Spin, Shift, Stretch :-)
d3dSprite.Transform = Matrix.RotationZ(visualAngle) *
Matrix.Translation(center) *
Matrix.Scaling(scale,scale,1.0f);

//Draw the sprite
d3dSprite.Draw(tiles.Texture, tilePosition, center,
position, Color.FromArgb(255,255,255,255));



Here's what I needed to have:

//Spin, Shift, Stretch :-)
d3dSprite.Transform = Matrix.RotationZ(visualAngle) *
Matrix.Translation(center) *
Matrix.Scaling(scale,scale,1.0f);

//Tell DirectX we are about to start drawing sprites
d3dSprite.Begin(SpriteFlags.None);

//Draw the sprite
d3dSprite.Draw(tiles.Texture, tilePosition, center,
position, Color.FromArgb(255,255,255,255));

//Tell DirectX we're done.
d3dSprite.End();


Here's what it looks like:

Player ship on screen

3 comments:

Anonymous said...

I don't know what this post is actually about, but I can't believe you read a manual.

In fact I bet you actually had Courtney read it for you, cuz I don't think men actually KNOW how to read a manual.

:-)

Primate Buddy said...

She says that like men don't read manuals. Unless I know how to do something already, I read the manual first. What's up with my wife?!?

Anonymous said...

I've never seen you read a manual in my the 13 years we've been together, Mister!