|
| | #61 (permalink) |
| Registered User Join Date: Dec 2003
Posts: 1,635
+1 Internets | protected Rectangle GetTitleSafeArea(float percent) { Rectangle retval = new Rectangle(graphics.GraphicsDevice.Viewport.X, graphics.GraphicsDevice.Viewport.Y, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height); thats what i have for a rectangle, i think its the same idea you have. again its just the code they gave me without really explaining it. ( i didn't paste in the xbox code also) |
| | |
| | #62 (permalink) |
| Registered User Join Date: Jul 2002 Location: Los Angeles California
Posts: 188
| this is a method called "GetTileSafeArea", that will return a Rectangle to whatever called it. Usually, you'll call like; myRectangle = GetTitleSafeArea(insertPercent) the percent i dont know what its doing since you didn't paste the code for it ![]() this next part actually creates a rectangle. The graphics.GraphicsDevice.Viewport.X is the top of your screen (0 to whatever your resolution is, lets say 800 by 600 is the res, so X could be between 0 and 800) Y is vertical down your screen from top to bottom, Width is the width of your viewport height is the height of your viewport. Rectangle retval = new Rectangle(graphics.GraphicsDevice.Viewport.X, graphics.GraphicsDevice.Viewport.Y, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height); basically this rectangle is going to be the entire length and width of your screen... starts in the upper left corner, and goes all the way down to the lower right corner taking up the entire screen |
| | |
| | #63 (permalink) |
| Registered User Join Date: Dec 2003
Posts: 1,635
+1 Internets | There is no code for the percent, or at least its not returning any other references. I still don't understand how i would make a sprite appear in the bottom right instead of top left or something, what values am i supposed to manipulate? |
| | |
| | #64 (permalink) |
| Registered User Join Date: Jul 2002 Location: Los Angeles California
Posts: 188
| 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 ![]() |
| | |
| | #65 (permalink) |
| Registered User Join Date: Dec 2003
Posts: 1,635
+1 Internets | MEGAUPLOAD - The leading online storage and file delivery service I just uploaded some C# Ebooks i was given a few months or so back, not sure how good they are these days but maybe someone can find use for them. 3 of them in a rar file. |
| | |
| | #66 (permalink) |
| Registered User Join Date: Apr 2007
Posts: 15
| Just have to say I'm really impressed with your work Cloud9. I really need to get off my ass and actually get cracking. If you can do that without prior experience in a few months, I should be able to at least get close with my programming experience from uni and hacking together projects for work. I think a big problem is that a lot of people who wrote tutorials and materials for XNA before or after the 1.0 release haven't been motivated to refresh those materials for the 2.0 release. |
| | |
| | #67 (permalink) |
| Registered User Join Date: Jun 2005
Posts: 50
| Ziggyware XNA News and Tutorials has a lot of articles/tutorials on XNA. I'll post some other links later. |
| | |
| | #69 (permalink) | |
| Registered User Join Date: Jul 2002 Location: Los Angeles California
Posts: 188
| Quote:
That being said, its SOOOOOO fun for me to learn the process. I actually told a friend who keeps begging me to put together the game already, that I'm having more fun programming the tools used to create the game than the game itself. Like i have an idea how i want to do a script engine, but i went beyond that and figured out a way to tie the script engine to an in-game script editor (like the map editor), should make for some good quests eh? ![]() | |
| | |
| | #70 (permalink) |
| Registered User Join Date: Jul 2002 Location: Los Angeles California
Posts: 188
| Thanks. As promised, i just got back from work so let me run through the process really quickly on what I used to learn C# and then eventually XNA. It worked for me, so I'm pretty sure anyone else can follow the path. First book I read was Microsoft CSharp Programming for the Absolute beginner. I got about halfway to 3/4ths through that before getting bored, and started making a text based RPG. As soon as I learned something, i tossed it into the RPG. For example; I learned about classes... so I made a player class. I learned about the System.IO namespace and saving data in text and binary files, so I implimented a savegame function. Learned about arrays? Great, now my hero has an exp table, just get creative with it ![]() Second book I read was "DotNetBookZero11" its a free pdf available on the internet, google it. Everyone kept telling me to read up on OO practices and what not, but I knew basically just keep everything "on its own" by making new classes and what not.. and I eventually learned what I needed as I made mistakes (and i made a LOT of them) From there i programmed a few text based items, my Text RPG was nothing more than a character generator and save / load character. When I learned about new classes and Inheritence, i programmed a snowball fight from the absolute beginner book, but without using the book as reference (re-creating the fight they walk you through in the book) Got comfortable with text, moved to windows. I re-did the snowball fight using windows forms.. and then created a 24 team Tournament Software program, and then a TF2 log parser to take the condump file and give players stats based on their achievements in game. Worked great, lots of bugs tho ![]() Picked up Beginning C# game programming by Rob something, great book! first part talks about C#for beginners, and next part talks about a lot of confusing things like DirectX and stuff... stuff that XNA takes care of for you. Then I started getting into XNA and just kept reading, reading, reading, and reading. Microsoft has a great video series on how to create a spaceship type game, learn 2d first. Start with that 2d game, then make a lunar lander game... once you have that, go with something a little more complex like breakout. I still have not made a tetris clone... Thats when I found xnaresources.com and their tilemap tutorial... its written for 1.0, so i had to do a lot of messing around, and thats what got me learning... and just continued to create from there. sorry that was kinda long, but basically all I'm doing is if i find out something I dont know... I try to learn it. Just a few days ago someone talked about Matrix, and I used that in my tile engine and map editor ... makes things SOOOO much easier Early on i didn't know what a "stack" ment, so I researched it, found it, now I'm creating a ton of game windows on a stack for easy access. Just keep learning and when you learn something, USE IT... don't worry about getting your game out, just learn. I hope to continue learning this for a long time, cuz its interesting to me.Ok i'll shut up now ![]() |
| | |
| | #72 (permalink) | |
| Registered User Join Date: Jul 2002 Location: Los Angeles California
Posts: 188
| Quote:
![]() Thanks for the .rar | |
| | |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
| |