• Content count

  • Joined

  • Last visited

Community Reputation

167 Neutral

About nooblet

  • Rank
  1. Language Advice

    Hi everybody,   Thank you all for the advice with this, especially lightxbulb for all of the resources for learning. I wouldn't necessarily classify myself as a "beginner", but I'm not great. I understand functions, classes, the flow of programs, arrays, looping, inheritance, and some other concepts. It's just "mastering" the language where I'm having trouble. Usually, when I learn a new topic for programming, then I immediately go out and create a new project and then get stuck again somewhere and stop learning again. I've made my own 2D games multiple times, and can say I'm a little better than most beginners, but I'm definitely not a great programmer as of right now I don't feel like.    I think what I'll do is do some more studying with C# for a few months. I'll learn some of the other topics for it, such as debugging, event-driven programming, collections, and lambdas (I think that's what they're called?), and then when I feel like I'm a confident C# programmer, I'll start to transition into C++ and eventually make that my primary programming language. I think it'll be easier for me to transition into C++ rather than trying to master it first, plus I really enjoy C# right now just because of how simple it is and how easily everything fits together.
  2. Language Advice

    Thanks everybody for your input with this.   @0r0d- It's not that I don't want to learn the material, it's the fact that I get frustrated with myself when I can't grasp the concept initially and eventually give up and blame the resource from which I'm learning the concept, although it's just me not pacing myself. Whenever I program without studying from a book or tutorial, I always have a blast and end up doing it for 12-14 hours straight because I don't realize the time has flown by.    @Ectara - Yeah, I definitely understand what you mean. When I was studying C++, I learned some object-oriented principles, and of course the basics (like variables, functions, blah blah), so when I transitioned into C# it was amazing how much simpler it was to learn and grasp new concepts instead of spending days reading books and tutorials to try and figure out what functions and methods meant :P.
  3. Language Advice

    Understood! I plan on going back to school this Fall, possibly taking care of my general education credits at a community college and then going to university again to work towards my CS degree (currently have enough credits to be considered a sophomore but didn't register for classes due to work). I think the points that you bring up is something that I needed to hear/read. I needed a reminder that I'll have to deal with topics that I may find boring to help land a career that I've wanted since high school. Again, I appreciate you taking the time to help me out with this! Thank you very much. For right now, I'm going to study the implementation and start self-teaching myself so that I can build my portfolio during school, and then I'll work towards the other topics when the time comes.
  4. Language Advice

    Hi frob,   It's funny that you of all people responded. I found a response from you in another thread (prior to creating this one) so I went through some of your posts to see your opinions and to do some more research. That, and I enjoy reading posts from those in the industry currently. To answer your question, although it's rhetorical (at least, the way I interpret it), I want to be a professional programmer (more specifically a game developer, but I'd like to branch myself out because I feel like the industry may be out of grasp for me), so it appears the next steps for me is to pick up a C++ book and try really hard to study these concepts and work my way towards becoming a professional.   Thank you for your insight, hopefully I can motivate myself to continue past my frustrations.
  5. Language Advice

    Hello! First and foremost, I'm very very sorry for creating another thread about this same topic. I've been searching the internet for opinions regarding this, but there's quite the diversity in responses it appears. Basically, I'm in a pickle between learning C++ and C# at this point. I'd like to elaborate for those who are interested in helping me.   I've been programming for many years, on and off, originally learning C++ and then migrating to C# when I realized how much easier it was. I absolutely love to program, but when I start to need to learn the "intermediate" or "advanced" topics of a language, I start to get discouraged and stop programming for months. I want to dedicate an hour or two of my time each day for the next year or so to just learn a language from the absolute basics to the more advanced topics. I don't just want to develop games, I want to become a programmer. I know for a fact that I'll have to learn C++ at one point in my life, but when I think about pointers, linked lists, algorithms, etc., I just want to immediately say "nope" and go back to C# where it's nice and cozy and I have someone holding my hand.   Basically, I'm relatively comfortable with both; with C++ I stopped using it when pointers were involved, and with C#, I stopped when I realized I had no idea what dictionaries do, how to do exception handling, or how to handle events. I want to become a programmer but I always get intimidated when it comes to more complicated topics and discourage myself from programming the next day. Not only that, but I can't ever find any good resources that appeal and grab my attention, and when I search on the forums, it usually has outdated recommendations that don't really work for me.   Anyways, I hope that covered where I'm at. If you have any recommendations, please feel free to throw them my way. Thanks so much!   TLDR: Stopped learning C++, went to C#, getting stuck at the "harder" subjects for both languages, and now I'm having trouble deciding if I should continue down C# or start to learn C++ now to make myself a better programmer. 
  6. Any good java programming books for begginers?

    Have you looked into MonoGame at all? It's built around the XNA framework and allows you to port your game into multiple OS's, and you don't have to learn an entirely different programming language. You can still use XNA to build basic 2D games on the PC for now, so if you're just trying to learn, it's still a viable solution.
  7. Sprite Facing Mouse

    Currently it's the cursor position on the screen. Input.MousePos is a read-only property that returns a new Vector2 of Mouse.GetState().X and Mouse.GetState().Y. Thanks for all the help so far!
  8. Sprite Facing Mouse

    [quote name='Khatharr' timestamp='1352960598' post='5001119'] Did someone seriously downvote Aliii for asking the most sane question in the circumstance? OP did not specify that debugging had happened, and debugging [i]will[/i] reveal the point at which the data is becoming incorrect. ... There's no reason to normalize the vector. This may be causing slight inaccuracies in the angle since all it's really doing is changing the granularity of the arc-tangent calculation. Also, try calculating the vector after the motion is processed. Is this a consistent problem or does it only occur while you're moving? I'm curious as to why you separate the atan2 from the vector calculation. It seems confusing to do part of a calculation, then do some different calculation and then finish the first one. [/quote] I've removed the normalization and it's still not working. Essentially, if my mouse cursor is at the top right, the sprite is looking at the top left. When I rotate the sprite using my mouse, it slowly catches up to the cursor, but then slows down again. I can provide more source code if needed? As for debugging - I've tried watching the rotation and direction.x and direction.y, but I'm not sure where they should be at. Finally, I moved the rotation calculation under the direction to avoid ambiguity. I'm still pretty new to this, so this is just for a learning experience.
  9. Sprite Facing Mouse

    [quote name='NickJohns' timestamp='1352916469' post='5000971'] This is how I do it in most of my games: float dx = Player.Position.X - MouseLocation.X; float dy = Player.Position.Y - MouseLocation.Y; float angle = (float)Math.Atan2(dy, dx); The only thing you really need to change, is switching your : direction.X = Input.MousePos.X - position.X; direction.Y = Input.MousePos.Y - position.Y; to direction.X = position.X - Input.MousePos.X; direction.Y = position.Y - InputMousePos.X; Hope that helps! [/quote] Thanks for the suggestion! I've switched them around as recommended, but unfortunately, it's not giving me the correct results . Anything else come to mind?
  10. Sprite Facing Mouse

    Hey all, So I'm trying to have a sprite face my mouse cursor, but with my current code, the sprite is -close-, but it's not fully rotating to face my cursor. I've pasted my Player.cs class below. Right now, I initialize the direction and rotation variables within my [b]Update(GameTime gameTime)[/b] class. I've already set the origin to be in the center of the sprite, so I don't think that's causing the issue. Thanks! [source lang="csharp"]using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; namespace MyTerribleGame { class Player { #region Data Fields private Texture2D texture; private Rectangle position; private int health; private int armor; private int lives; private int velocity; private Vector2 direction; private float rotation; #endregion #region Properties public Texture2D Texture { get { return texture; } set { texture = value; } } public Rectangle Position { get { return position; } set { position = value; } } public int Health { get { return health; } set { health = value; } } public int Armor { get { return armor; } set { armor = value; } } public int Lives { get { return lives; } set { lives = value; } } public int Velocity { get { return velocity; } set { velocity = value; } } #endregion #region Constructors // Default Constructor. Will be removed when there's more implementation. public Player() { health = 100; armor = 100; lives = 100; velocity = 10; } // Overloaded Constructor. Possibly will become the new default. public Player(Rectangle position, int health, int armor, int lives, int velocity) { this.position = position; = health; this.armor = armor; this.lives = lives; this.velocity = velocity; } #endregion #region Methods // Load the content of the player class. public void LoadContent(ContentManager Content) { texture = Content.Load<Texture2D>("Player/playerRed"); } // Update the player, such as input, collision detection, etc. public void Update(GameTime gameTime) { direction.X = Input.MousePos.X - position.X; direction.Y = Input.MousePos.Y - position.Y; direction.Normalize(); if (Input.IsKeyDown(Keys.W)) { position.Y -= velocity; } if (Input.IsKeyDown(Keys.S)) { position.Y += velocity; } if (Input.IsKeyDown(Keys.D)) { position.X += velocity; } if (Input.IsKeyDown(Keys.A)) { position.X -= velocity; } rotation = (float)Math.Atan2(direction.Y, direction.X); } // Draw the player to the screen. public void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(texture, position, null, Color.White, rotation, new Vector2(position.Width / 2, position.Height / 2), SpriteEffects.None, 0); } // This version of CheckCollision is used to check for collision between the screen and the player. public void CheckCollision(GraphicsDeviceManager graphics) { if (position.X <= 0) position.X += velocity; if (this.position.Y <= 0) position.Y += velocity; if (this.position.X + this.position.Width >= graphics.PreferredBackBufferWidth) position.X -= velocity; if (this.position.Y + this.position.Height >= graphics.PreferredBackBufferHeight) position.Y -= velocity; } // 2D Bounding Box collision b/w the player and an object. public void CheckCollision(Rectangle obj) { // Player -> Object // Right -> Left if (position.Right > obj.Left &amp;amp;&amp;amp; position.Left < obj.Left &amp;amp;&amp;amp; position.Bottom > obj.Top &amp;amp;&amp;amp; position.Top < obj.Bottom) { position.X -= velocity; } // Left -> Right if (position.Left < obj.Right &amp;amp;&amp;amp; position.Right > obj.Right &amp;amp;&amp;amp; position.Bottom > obj.Top &amp;amp;&amp;amp; position.Top < obj.Bottom) { position.X += velocity; } // Top -> Bottom if (position.Top < obj.Bottom &amp;amp;&amp;amp; position.Bottom > obj.Bottom &amp;amp;&amp;amp; position.Right > obj.Left &amp;amp;&amp;amp; position.Left < obj.Right) { position.Y += velocity; } // Bottom -> Top if (position.Bottom > obj.Top &amp;amp;&amp;amp; position.Top < obj.Top &amp;amp;&amp;amp; position.Right > obj.Left &amp;amp;&amp;amp; position.Left < obj.Right) { position.Y -= velocity; } } #endregion } } [/source]
  11. I think you need to understand how game development works before you start using an engine to make a game. First and foremost, I'd recommend you start learning C#. Work on data types, if-else statements, game loops, collections, properties, classes, polymorphism, inheritance, encapsulation, arrays, the list goes on and on. Once you understand the basics of C# programming, then you should move onto programming with XNA. You can then write 2D or 3D games with XNA, understand how the design and coding process works when creating a graphical game. Once you have a solid foundation with XNA, you should start moving into Unity. Unity supports C# for writing scripts, and you'll understand the basics of 3D game development, so by then, Unity will be very easy to pick up and start developing your game.
  12. C# books

    That book is geared towards professional programmers looking for a quick guide to getting started with C#. It's very good for a reference or those with previous experience, but not good at all for the absolute beginner.
  13. Menu Fading

    Hahahaha. After I reviewed my post on here, I managed to find the problem. I was setting the new Color when I drew the actual MainMenu texture, not on my black rectangle. Working now. Thank you!
  14. Menu Fading

    Hey everybody! So I'm working on my own Snake clone using C# and XNA, and I created a very simple state manager to cycle through the menu and game states. I know, I know, "why re-invent the wheel? why not use the GameStateManagement sample?". Honestly, I'm having trouble understanding their code, and need more time to digest it. I don't need a fancy menu or state manager, just the very basics so that I can create a game. Moving on! I'm trying to add a fade effect to my splash screen. Essentially, I want the screen to slowly become black, and then after five game seconds, switch to the Main Menu state. Unfortunately, when I try to increase the transparency so that it goes from white to black, it just leaves fills in the entire background with a black screen (almost like the new Color(255, 255, 255, fadeValue) argument isn't being called). Here's the source code: Splash.cs [source lang="csharp"] using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; namespace Snake { static class Splash { #region FIELDS // These are the splash screen's data fields. private static Texture2D texture; private static Rectangle position; private static Texture2D spacer; private static int fadeValue = 1; #endregion #region METHODS /// <summary> /// The LoadContent(Content) method will load the default content into memory. /// </summary> /// <param name="Content"></param> public static void LoadContent(ContentManager Content) { // Load the texture for later use. texture = Content.Load<Texture2D>("Screens/Splash"); spacer = Content.Load<Texture2D>("Spacer"); // Create a default position for the splash screen. position = new Rectangle(0, 0, 800, 600); } /// <summary> /// The Update(gameTime) method will be called each frame and handles all game logic. /// </summary> /// <param name="gameTime"></param> public static void Update(GameTime gameTime) { // If the total GameTime (since the program started) has gone over a second, or a key is pressed, change the game state. if (gameTime.TotalGameTime.TotalSeconds >= 5 || InputManager.AnyKeyPressed()) { ScreenManager.State = MenuState.MainMenu; } if(fadeValue < 255) fadeValue += 1; } /// <summary> /// The Draw(spriteBatch) method will be called each frame and handles the drawing logic. /// </summary> /// <param name="spriteBatch"></param> public static void Draw(SpriteBatch spriteBatch) { // Create a new SpriteBatch to avoid overwriting layers. spriteBatch.Begin(); // Draw the splash screen to our buffer. spriteBatch.Draw(spacer, new Rectangle(0, 0, 800, 600), new Color(255, 255, 255, 200)); spriteBatch.Draw(texture, position, new Color(255, 255, 255, fadeValue)); // End the SpriteBatch object. spriteBatch.End(); } #endregion } } [/source]
  15. XNA - Problems With ContentManager

    Are you loading or drawing using SpriteFonts in your test environment? If so, can we see the code that loads those fonts?