Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

102 Neutral

About TheDodo

  • Rank
  1. I have my bullet collision working properly in every situation except for one. This is a 2D shooter in C#, when the player sprite is pushing against a wall either going to left to right or bottom to top the bullet does not detect any collision, but if it is from right to left or top to bottom it detects the collision. The bullet spawns at the edge of the sprite with the center being on the edge. Here is the collision code I am using. I am comparing the current position and next position of the bullet against the position of the wall to determine if the bullet will collide with the wall on the next frame. Then I move the bullet to the position of the wall, and use the rectangles to detect the collision. private void CollideWall() { foreach (Vertical aVert in level.Vertical) { if (collisionRect.Intersects(aVert.outerRect)) { if (position.X >= aVert.collisionRect.Right && nextPos.X <= aVert.collisionRect.Right) { position.X = aVert.collisionRect.Right; } if (position.X <= aVert.collisionRect.Left && nextPos.X >= aVert.collisionRect.Left) { position.X = aVert.collisionRect.Left; } if (collisionRect.Intersects(aVert.collisionRect)) { damage = 0; visible = false; } } } foreach (Horizontal aHoriz in level.Horizontal) { if (collisionRect.Intersects(aHoriz.outerRect)) { if (position.Y >= aHoriz.collisionRect.Bottom && nextPos.Y <= aHoriz.collisionRect.Bottom) { position.Y = aHoriz.collisionRect.Bottom; } if (position.Y <= aHoriz.collisionRect.Top && nextPos.Y >= aHoriz.collisionRect.Top) { position.Y = aHoriz.collisionRect.Top; } if (collisionRect2.Intersects(aHoriz.collisionRect)) { damage = 0; visible = false; } } } }
  2. I am using C# and XNA, and I am wanting my sprites to look like they are scanning the room for enemies. I need to be facing the direction they are going and then rotate slightly each way with the center point being the direction the sprite is facing. I can do each one separately, but I can't figure out how to combine them. Any help will be appreciated.
  3. As I only really started to learn XNA at the tail end of 3.1 so I didn't really get familiar with it, what features were cut?
  4. TheDodo

    Good AI Programming Books

    Sticky topic at the top of the forum. You'll know which one. [/quote] Yes, but that doesn't cover what I asked, which was a C# specific book.
  5. Hey, I'm doing an independent study this coming semester where the large majority of my time will be focused around game AI. I am doing this in C# with XNA, and am having trouble finding any books that cover this topic using C#. I am hoping some people on here might know of any? Even though I am looking for C#, I am open to non-language specific books as well.
  6. TheDodo

    C++ or another language

    As someone who tried to learn C++ through a college course twice, and failed miserably, but has found it relatively easy (still not easy) to learn C# with little to no outside help I would recommend learning C#. Not only is C# easier to understand, it has a bright future ahead of it. Right now if you wanted to be part of a team creating a full $60 console game you most likely would need to know C++ that is only a relatively small portion of the market, and with tools like Unity using C# is slowly changing. On most other platforms it is more likely you will be using a language more like C# than C++, such as Java, Python, etc.
  7. This is the code I am using. Pretty standard I believe. public bool IsCircleColliding(Vector2 otherCenter, float otherRadius) { if (collidable) { if (Vector2.Distance(spriteCenter, otherCenter) < (collisionRadius + otherRadius)) { return true; } else { return false; } } else { return false; } } I am assuming in order to determine which part of each circle is colliding I need to determine which side of each sprites rectangle is colliding, that is pretty simple. My question is if there is a better way to do this?
  8. TheDodo

    Get and Set

    Thank you, I think collectively you guys have explained it well enough, and left me with some things to think about. If there is anyone late to the party that thinks they have a better answer though go ahead and say it, if it doesn't help me it might help another beginner lurking around.
  9. TheDodo

    Get and Set

    I have never had 'get' and 'set' explained in a way that I am able to understand what their purpose is, or why they are needed. I can go out there and found two different examples of code that work exactly the same way with one having properties that use 'get' and 'set', and the other doesn't. If you can do it without using them then it just seems kind of like a waste of time to use them. So, unless they are just archaic left overs from a bygone era, it is obvious they are useful, I just haven't had it explained in a way that I understand. I would greatly appreciate it if you guys could help me with this.
  10. Thank you for your help.
  11. Hello, I am fairly new to programming. I am trying to build an object with multiple sprites on a sprite sheet, with the top layer of sprite being centered on the bottom sprite. I have been able to build an object with multiple sprites, but haven't been able to get it to be centered, and can't seem to find any tutorials on it. I am curious if anyone might post a quick example of how this would be done, it would be highly appreciated.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!