This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - BlakPilar
Pages: 1 ... 33 34 [35] 36 37 ... 49
511
« on: September 13, 2011, 08:01:54 pm »
I love HTC as well, and I have the Droid Incredible 2. I have no complaints about it and I think it's an amazing phone (then again, it is my first smartphone ). Here's an unlocked version for $234 (the cheapest I saw on Google's shopping thing.)
512
« on: September 12, 2011, 08:48:38 pm »
NNOOOOOOOOOO! (I already had my rant about that at the top of some page lol)
513
« on: September 12, 2011, 08:48:13 pm »
@BlakPilar Listen to Builder
I understood what he meant when he first said it
514
« on: September 12, 2011, 08:22:47 pm »
I do lol, that's how I prevent an infinite loop. After using the sub, I cut off the decimal part of the original number divided by the length of the base-string. (Read Builderboy's response lol) All my knowledge of base conversion comes from TIBD, which I'm glad I took the time to read (that article, that is).
515
« on: September 12, 2011, 08:14:46 pm »
WAIT WAIT, LET BLAKPILAR GUESS!
It's your birthday.
EDIT: Happy birthday!
516
« on: September 12, 2011, 08:11:17 pm »
Yeah, that was me in class, working on this. I constantly went over it and over it and over it and it wouldn't so I figured I'd bring it here to avoid further frustration lol
517
« on: September 12, 2011, 08:00:27 pm »
Ah-hah! Thanks Builderboy!
518
« on: September 12, 2011, 07:42:37 pm »
Ok, first off, PLEASE don't give me another routine (I am aware that Weregoose (I believe) has a super-optimized base converter algorithm), I just want to see if the one I'm trying will work. Now, in theory (or at least through my way of thinking), this routine should work, but I get an error for anything other than hexadecimal. Here's all of the code for it: "0123456789ABCDEFG→Str2 length(Str2→L
Input "DEC: ",D "_→Str1
If 0>D or not(D "0→Str1
While D>0 sub(Str2,L(fPart(D/L))+1,1)+Str1→Str1 iPart(D/L→D End
Disp Str1
However, I keep getting errors during the first run-through on the sub command. I've manually checked all the variables' values (using 50 as my test value) and the very first letter should be G, but I keep getting a domain error with the cursor scrolling to the closing parenthesis of the sub command. Any ideas?
519
« on: September 12, 2011, 07:30:08 pm »
Is that the only reason you got it? (It would've been mine if I got that phone xD)
520
« on: September 12, 2011, 07:21:42 pm »
Have you heard about the sick juggler?
521
« on: September 12, 2011, 07:14:43 pm »
Oooo, which one DualBLDR?
522
« on: September 12, 2011, 03:51:30 pm »
Consolas<3
523
« on: September 11, 2011, 07:28:30 pm »
Nice! It looks a lot better. I especially like how the flashlight is more realistic. Good job!
524
« on: September 10, 2011, 04:46:50 pm »
Hahaha, nice Ashbad and ztrumpet. How do you catch a unique rabbit? How do you catch a tame rabbit?
525
« on: September 10, 2011, 04:32:06 pm »
I'm writing a game in XNA 4.0 (my first huge computer game for both XNA and C#), and one of the things I wanted to do for the main menu was add a snow effect because the game is called Tundra and a tundra is a cold and snowy place and, well, I think you get the idea. I thought it looked pretty cool when it was done, and figured maybe the function I created could be used for something else by somebody else, so here it is! First, for ease, what I did was create two public properties to be equal to the width and height of the game window. Basically, it looked like this: private int w, h; public int Width { get { return this.w; } } public int Height { get { return this.h; } }
protected override void Initialize() { this.w = this.Window.ClientBounds.Width; this.h = this.Window.ClientBounds.Height;
//There's more code in here, just not needed for this tutorial }
Just try to remember to not assign to h or w After that, I made some variables all dealing with the snow. I made them private because I'm more than likely not going to use them specifically outside of my method to draw the snow, but you can feel free to make them public. private Point[] snow = new Point[225]; //You can increase/decrease this number depending on the density you want private bool isSnowing = false; //I only set this to true (so far) in the main menu private Texture2D snowTexture; //Our texture for each snow particle. I'll attach mine, though it's very simple private Point quitPoint; //The point at which we need to recycle the snow particle private Point startPoint; //The point where the snow particle gets recycled to private Random random; //Will be used for generating new random numbers
For quitPoint and startPoint, we'll only be using their Y-coordinate. Now, go to the LoadContent method. Here we'll load the snow's texture as well as the quit and start points. If you do these points in Initialize, you'll get a NullReference error because XNA calls LoadContent after Initialize (in case you didn't know). protected override void LoadContent() { //Load our texture. I placed it in a folder called "Textures," if you don't put it in any folder, don't use "Textures\\" //or if you use a different folder, replaces Textures with its name. this.snowTexture = this.Content.Load<Texture2D>("Textures\\snow");
//Set the snow's quit point. It's the bottom of the screen plus the texture's height so it looks like the snow goes completely off screen this.quitPoint = new Point(0, this.Height + this.snowTexture.Height);
//Set the snow's start point. It's the top of the screen minus the texture's height so it looks like it comes from somewhere, rather than appearing this.startPoint = new Point(0, 0 - this.snowTexture.Height); }
If you want to be exactly like me, somewhere in your code, make a method called DrawSnow that doesn't take any parameters. We'll come back to that in a second. Head on over to your draw function and call DrawSnow between where you begin and end the sprite batch. Also, change the clear color from CornFlowerBlue to White. Now for the meat and potatoes of this tutorial! I'm just going to copy and paste my code, but I'm adding comments that will tell you what's going on. public void DrawSnow() { //If it's not supposed to be snowing, exit if (!isSnowing) return;
//This will be used as the index within our snow array int i;
//NOTE: The following conditional is not exactly the best "initializer." //If snow has not been initialized if (this.snow[0] == new Point(0, 0)) { //Make the random a new random this.random = new Random();
//For every snow particle within our snow array, for (i = 0; i < this.snow.Length; i++) //Give it a new, random x and y. This will give the illusion that it was already snowing //and won't cluster the particles this.snow[i] = new Point( (random.Next(0, (this.Width - this.snowTexture.Width))), (random.Next(0, (this.Height)))); }
//Make the random a new random (again, if just starting) this.random = new Random();
//Go back to the beginning of the snow array i = 0;
//Begin displaying the snow foreach (Point snowPnt in this.snow) { //Get the exact rectangle for the snow particle Rectangle snowParticle = new Rectangle( snowPnt.X, snowPnt.Y, this.snowTexture.Width, this.snowTexture.Height);
//Draw the snow particle (change white if you want any kind of tinting) this.spriteBatch.Draw(this.snowTexture, snowParticle, Color.White);
//Make the current particle go down, but randomize it for a staggering snow this.snow[i].Y += random.Next(0, 5);
//Make sure the point's location is not below quit point's if (this.snow[i].Y >= this.quitPoint.Y) //If it is, give it a random X value, and the starting point variable's Y value this.snow[i] = new Point( (random.Next(0, (this.Width - this.snowTexture.Width))), this.startPoint.Y);
//Increment our position in the array ("go to the next snow particle") i++; } }
Voila! You now have snow in your program! If you need something explained more, feel free to ask. If you have imporvements, say so and I'll add them. If you want to use this somewhere (not necessarily in C#/XNA), feel free to go ahead and do so! In this, I only change the Y position of the snow particles. If you want to do something with the X to make it more realistic, go right ahead. I've attached a gif of what it looks like in Tundra but thanks for your time P.S. - If this is in the wrong category, please move it to the appropriate one. I've had problems with that in the past lol
Pages: 1 ... 33 34 [35] 36 37 ... 49
|