Jesse Emond
• Member for 11 years, 4 months
• Last seen more than a week ago

The tangent formula is this: tan(angle) = opposite/adjacent Refer to this drawing: Where a is the adjacent side, o is the opposite side and theta is the angle. Similarly, sine and cosine are sin(...

If I understood your problem properly, you just want to shoot a bullet towards a mouse position. Here is how I would do: First of all, you must find the movement required for the bullet to get to the ...

My advice would be not to try to delve into too much details yet. Get a general feel of what type of game you want, with a core gameplay feature that you really want. Once you know what the main ...

Since your ball is scaled, it means that using the texture's width (basketball.Width) is not correct, since the real width is the texture's width times the scale. Your code would change like this: ...

This is because once your object gets into the wall and you find the collision, you're simply stopping the object's movement by setting its velocity to zero, but the object is still within that wall. ...

If I understand your problem properly, you should just have a direction Vector2 representing the direction you want to move in inside your sprite class. Like this: public Vector2 Direction { get; set;...

The positions that you store within cursorX and cursorY hold the position of the cursor relative to top left corner of your screen monitor (since you add the ClientBounds to it). I'd guess that you ...

What about a component-based engine? You would have a main class named Engine, which would keep a list of GameScreens, which would themselves hold a list of Components. The engine has an Update and ...

Well, if you want to use it for 2D games (assuming from the tags), you only need a Transform matrix to apply to the SpriteBatch, you don't need World and Projection matrices. So, when you're drawing ...

The part (float)rand.Next(0, 1000) generates a number between 0.0f and 999.0f inclusively. Then, you divide it by 10 to get a number from 0.0f to 99.9f. Checking if the number is below or equal to 0....

Since this is based on your other question I'll give a solution for when the rectangle is axis-aligned. First, you build up you current object's rectangle with the following values: int boxLeft = ...

I'm not sure if I understood your problem correctly, but I assumed that what you want to do is find the resultant direction of you ball after a collision. Here's a quick drawing on my white board ...

I personally give up easily on projects, so I found out something that keeps me interested throughout the whole development process. I start out really small, like drawing a character to the screen. ...

I think java proved itself as quite a viable programming language for programming games the same way that C# did with libraries such as XNA. It may not be as efficient as a low-level language like C++ ...

I'd recommend profiling first and check if the touching check really is a bottleneck. Test with the maximal amount of objects that your game will use as a final product and see if you get frame ...

I don't know if I understand your problem correctly, but here is how I would go with the constraints that I understood: I guess you could simply apply gravity to the ball, then resolve the collision ...

As much as I agree that preincrementing is intuitively faster (because the implementation does not involve a copy), I would expect the compiler to actually optimize both calls to become equivalent in ...

You want to modify the player's position, not its source rectangle. As I understand it, you use playerRect to represent the rectangle inside the image to draw, in order to animate it properly. That ...

Kind of a simple advice here but a little something that I found very useful is displaying debugging strings/rectangles to the screen. You can print the player's current state, the enemy's animation ...

You could add more visual effects to the game to make it visually appealing (especially when a player wins. I personally don't like the classic "You won!" text, I prefer fireworks and fire all over ...

For this type of game, I'd like to refer you to a question that I asked before: Basically the idea is that you keep a power score for every unit owned by a player. This score can be based on the ...

I guess there is no pre-made mathematical formula to evaluate how fair a game is because of how every game is so different and complex. You can't really compare different game parameters and make up ...

Basically it allows you to have an input vector different from an output vector, like so: D3DXVECTOR3 bulletMovement = /*...*/; // the whole bullet movement D3DXVECTOR3 bulletDirection = /*...*/; // ...

For your first question, I must admit that I don't really know the actual answer. I guess it would be for the same reason as to why singleton is generally a bad design pattern. I'll refer you to a ...

The problem comes from your spriteBatch.Begin call. You're passing SpriteSortMode.BackToFront and since both of your layerDepths are equal to 0, I'd guess that the order would get mixed up when the ...

For the curve or straight line problem, I think I'd keep a list of the positions of old input. Then, I'd check the slope between every point (delta Y / delta X). If the slope does not change a lot, ...

In addition to @tesselode's answer, I would recommend you keep a list of attached objects for every world object in your game. Something along the lines of List<WorldObject> AttachedObjects. ...

What's wrong with using directories with broad categories? You can just put more specific categories if you find that you really have too many assets within a directory. You could just organize it ...