New answers tagged

0

Here is a quick and easy way to implement a 3rd person camera within the code base of your project. Normally, I'd recommend placing these changes in the Update method instead of the Draw method but that would require a bit of refactoring of your code base that is beyond the scope of this question. Change this section: Matrix[] transforms = new ...


0

I would do both. I would make separate arms, legs, body, and head classes and keep track of them all within a player class. This way, in your Game1 class and other classes, the player is treated as ine object, but within the class, the body parts are treated separately. Hope this helps!


0

Take a look at this overload of the SpriteBatch.Draw() method. What you want to do is have the origin argument be a Vector2 with its x-coordinate set to half the width of your final image (and whichever y-coordinate you feel is appropriate), and increase the scale argument from (0,1) to (1,1) over the course of time it takes to "unfold" the paper. Since ...


-1

I would use a bump map - a texture of the waves, and then use some shader magic to make it look like there are waves. This is relatively cheap compared to creating custom meshes. The downside is that there are some edge artifacts and you need to make sure to resize all your render targets when you resize the viewport. There's a Riemers page on this: ...


0

So, there are 2 solutions, one with trigonometry and one with linear algebra. Depends on you wich one you use. I assume you have a vector for the player position (p with p.x, p.y and p.z as coordinates) and a rotation around the y axis (yAngle). Also, declare a distance from the player (d) and the angle between the camera and the ground (hAngle) ...


0

First things first: You are free to call the ContentManager at any point in your game cycle (you're not restricted to the use the LoadContent() method created in the main class). This doesn't solve your memory problem though, so on to part two: If you run into memory issues because you have too much content loaded at the same time, you should only load the ...


0

So the answer seems a lot easier than I expected, if I'm doing it right at the moment(?). I simply Load the content needed for all "Worlds" in the beginning of the game (in the Protected Overrides Sub LoadContent()) and then Dispose() and Load.Content() depending on what World is loaded later (in any Sub I choose): TextureName = Content.Load(Of ...


1

If you want to accomplish something like this: You can do this pretty easily. If you create 3 different gameobjects, each with a SpriteRenderer: The Gameobject on the left, has a blank image with a pivot set to TopLeft. The Gameobject on the right, has the same image, however, the pivot is set to the TopRight. Re-position these gameobjects, so ...


3

Yes. The MonoGame API is intended to be exactly the same as XNA. In most cases this is entirely true. If MonoGame doesn't work just like XNA it's usually considered a bug. The exception to the rule is the way the Content Pipeline works. Although, once you get your head around it things are fairly similar.


0

You can try to add this line: gameStateManager.getLevel(1).LoadContent(); It may help you to achieve GAME RESTART, but I'm not 100% sure because I'm new as well.


0

A very high-level thought would be to separate your sprite-sheet into different sheets for each direction so that on different key-presses you can specify which sheet to cycle through, and then you don't need to worry about confusing offsets


1

For posterity...it ended up being a simple handedness issue, but only around the Y (pitch) axis. I had it stuck in my head that positive pitch increases Z and negative pitch decreases Z, which isn't true in a right-hand system. Lesson learned!


1

You can accomplish this by using linear interpolation. https://msdn.microsoft.com/en-us/library/bb197807.aspx float speed = 0.1f; //value between 0 - 1 Position = Vector2.Lerp(Position, DesiredPosition, speed); Another way to do it is to incorporate a time value, while keeping track of the start and end positions. This ensures the movement will be the ...


0

You should probably store Pac-Man's position with sub-tile precision, either using a float, or using a tile-subdivision as your unit of distance (which is basically fixed-point). Using floats is conceptually easier and probably a bit faster on modern hardware, but introduces some problems due to the way floating point math works (you can't rely on equality, ...


2

Both XNA and Fabian Giesen’s implementation behave correctly. Transforming vector (1, 0, 0) by quaternion (w=0.6532815, x=-0.270598, y=0.270598, z=0.6532815) does resut in (0, 0.7071, -0.7071). It also does in Unreal Engine, in my own quaternion implementation, as well as in Wolfram Alpha. Wolfram Alpha also gives the 3×3 matrix equivalent of the ...


0

Welcome to XNA! First off, I'l strongly advise you to switch to Monogame. It uses the same bindings as XNA and your workflow will not change much. Plus it is under active maintenance. Also, before you rush into making a game you should check out some tutorials on sprite animation and frame independent movement. On to your question then. I've posted the ...


0

If your camera is always facing the same direction (let's say north) and just pans in the horizontal plane, use quads in a 3D plane to draw your scene. Since the camera is not rotating, you don't need to change the facing of your quads, just put them in the right spot in your 3D scene. Note the camera is orthogonal for the effect. If the camera is not fixed ...


2

When you have multiple collisions if you rectify your collisions from closest to farthest away from the center of each rectangle involved, you will not have the issue of "hanging." 1) Find all the colliding rectangles 2) If there are more than one (depending on your use case this can be frequent or infrequent), find the closest. 3) Resolve collisions ...


0

You can try to set the TextureFormat to NoChange in the Content Pipeline app for your sprite fonts. That's what I do for all of my assets. I don't want to lose quality due to compression. Also there's some sprite font problem going on in the MonoGame repo on GitHub, they will be fixing it this week.



Top 50 recent answers are included