Thread: XNA using C#
View Single Post
Old 03-26-2008, 04:19 PM   #64 (permalink)
Cloud9_
Registered User
 
Join Date: Jul 2002
Location: Los Angeles California
Posts: 228
+9 Internets
Send a message via ICQ to Cloud9_
i'll have to explain more detail when i get home, omw out the door right now... but what you can do is in your project find out what rectangle is being used to draw the character... or you could create one.

Somewhere at the top of the project, inside the class, type

Rectangle myCharacterRectangle = new Rectangle(x,y,width,height);

X = where left to right you want him
Y = top to bottom
Width = how wide he is
Height = how tall he is... so forexample

Rectangle myCharacterRectangle = new Rectangle(200, 200,50,100);

he will be placed at the 200,200 point on the screen (somewhere in the upper left corner) and be 50 pixels wide, 100 pixels tall.

Now locate your Draw method. type;


spriteBatch.Begin();
spriteBatch.Draw(CharacterTexture, myCharacterRectangle, Color.White);
spriteBatch.End();

That will draw whatever texture you've selected for the character, ONTO the character rectangle you created above, with no tint (color.white). To move that character around, you just need to find a way to manipulate the X, Y (or the 200 / 200 in your case)

When I get home from work i'll try and post some of my early code if you want, the stuff im working on now would confuse you... it confuses me
Cloud9_ is offline   Reply With Quote

 
Uberguilds Network