17

I will try to answer briefly. Why is the circle represented as 1,1 and -1,1? This thing is usually called Unit Circle, because its radius equals to 1. How it is relative to trigonometry you're trying to solve? Let's see. Why is Y = sin and X = cos? Well, let's look at the picture I've made five minutes ago (sorry, it's not the best my work). You can ...


14

Camera matrix transformations are easy Creating a basic camera is easy. Below will get you started with the basics. Moving it around, rotating, ans scaling. Moving every 2d sprite isn't much of an issues but if you factor in either scaling or rotation then it gets really hard to apply to every sprite individually. class Camera2D { public float Zoom { ...


11

This should do the job. In the end of every update loop, save state of previousGamePadState. Then you can compare em. This is fast way to detect changes. No need to loop. GamePadState.PacketNumber: You can use PacketNumber to determine whether input state has changed. If the value of PacketNumber remains the same between two sequential calls to GetState, ...


11

To maintain the shape while spreading, each bullet needs to have a different speed. Suppose you are going to create a "wave" of bullets originating from a centerpoint, what you need to do is to calculate the speed each bullet needs to have to maintain the contour of the shape. See below: the red bullet moves slower than the green bullet in order to enlarge ...


10

I found out that the Content.mcgb is actually a little GUI helper and you can generate and easily load a .spritefont file with it. Steps: 1.Load the GUI app by double clicking the "Content.mcgb" file in the "Content" folder 2.Go to Edit -> New Item... -> Choose SpriteFont and give it a name -> Hit "Ok" 3.Go to Build -> Build (or hit F6) - You should get ...


9

Generally the way most physics engines handle this problem is by separating the intersecting objects. So if your objects are represented by rectangles (also known as "Axis Aligned Bounding Boxes"), and they collide on a given frame like so: You would then measure the amount of interpenetration on each axis. Then select the axis with the smallest ...


8

You could use polygons, or you could do a quick and dirty hack and just get a political map like this one: (source: freeusandworldmaps.com) . Then, pick a unique color for each country and flood fill it in paint or photoshop. Then, you have a simple file that just has the mapping of countries/provinces to particular colors. Just something like this: # ...


8

The MonoGame.Extended project loads Tiled maps using a custom content importer. I wrote a tutorial about how to create custom content importers on my blog. Of course, as @Shiro mentioned in the comments you don't need the Pipeline to load your own content with MonoGame. Just be aware that to make it work across all platforms you'll need to use ...


7

There's no need to do anything complicated. The GameTime.ElapsedGameTime property is a TimeSpan representing the amount of elapsed game time since the last update. Therefore, if you want to measure your game updates in seconds the easiest thing to do is this: protected override void Update(GameTime gameTime) { var delta = (float)gameTime....


7

Given SpriteFont font; Do this: Vector2 size = font.MeasureString("Your String Here");


7

I'm not familiar with xna... but I know maths. And implementing physics without understanding the math behind it is like going into politics without knowing how to lie. So let's get started! First of all, your way of moving the ship around isn't really physics based. You don't want the player to change the position of the ship directly. What you want to do ...


7

When you ask Why is sin = Y and cosine = X? I read your question as Why is the function that gives me the Y axis called "sin" and why is the function that gives me the X axis called "cosine"?, so I'll start by answering that... At its heart, it is a naming convention. If you have a unit circle with the common trigonometric functions... ... you'll see that ...


6

I found that in order to get window resizing to work properly, you need to handle resetting the Graphics Device parameters manually, when the window is resized: this.Window.AllowUserResizing = true; this.Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged); void Window_ClientSizeChanged(object sender, EventArgs e) { ...


6

The problem The problem lies in your method of collision resolution. Your method goes as follows: Move the player. Check for collision. Determine the shortest collision depth. Resolve collision. The problem with this, is that it can easily move the player in the wrong direction. You can see how this might happen in the image below: Because the player is ...


6

Your server would have some kind of background process (could also be implemented as a timer or a thread) which runs at regular intervals and updates all players. The process would run daily, hourly or every few minutes depending on how often you want the players farms to update and generate resources. Any online players would get notified immediately that ...


6

An AABB is an axis-aligned bounding box. It is a box whose sides are aligned with the axes of the world, and which has extents along each axis. By "AABBvsAABB" your instructor is trying to tell you to make an intersection test between (versus) two AABBs, finding whether they intersect, how they intersect, etc. There are algorithms to find intersections for ...


6

The problem with dealing with gamestates in an enum and a big switch statement and dealing with transitions is that you want also keep track of what the previous state was. This becomes more complex is some states may be triggered at various points during gameplay (options screen, inventory screens, other special states). So to deal with transitions more ...


5

Pretty sure the easiest way to do rotation like this is to actually hard-code a simple rotation of the underlying array representing the isometric world. Say you have a small array representing tiles, something like this (9 tiles total): [0 2 0] [1 0 4] [1 0 1] Rotate 90 degrees clockwise could be done by swapping the numbers in the array around: [1 1 0] ...


5

This question is probably off-topic but here's my 2 cents anyways. Working on what you love, when you feel like it is probably going to yield the best benefits. By that I mean that if you don't feel like working on a game when you get home but force yourself to do it anyways, you won't grow as much and you'll probably get burned out really quickly. So ...


5

Applying a matrix to your SpriteBatch transforms the entire draw call at once. This means you don't need to use your camera in your DrawTiles method at all. It could become a lot simpler like so: // Loop through the number of visible tiles. for (int y = 0; y <= tiles.GetUpperBound(1); y++) { for (int x = 0; x <= tiles.GetUpperBound(0);...


5

Step 1 - Don't check collisions in each key, test them at the end In your example, you are checking collisions for each key independantly. This will cause some trouble and code replication. In order to avoid that, I would suggest you use temporary variables that will stock the movement, increment it for each key and test collisions only once at the end: ...


5

One way to do this, is to draw your text 2 times in a different color at specific offsets. For example: public static void DrawText(SpriteBatch spritebatch, SpriteFont font, string text, Color backColor, Color frontColor, float scale, Vector2 position) { Vector2 origin = Vector2.Zero; spriteBatch.DrawString(font, text, position + ...


5

I'd like it to be at least vaguely human-editable I would take this to be your first requirement. Storing it in the colour data of a bitmap is probably not going to help here so I'd go with something else. For a 2D tile based game it might be worth investing some time to learn how to use an existing tile based map editor like Tiled. I'm currently adding ...


5

1. Creating textured model in Blender First, add a new texture by going to texture panel on the right. Select type "Image or Movie", click "Open" and locate your texture file. Then, move your mouse to the 3d view, press Tab to select the default cube, then press "U" and select Unwrap. Go to UV Image Editor: and select the texture: At this point, the cube ...


5

I don't see why you couldn't use it! Keep in mind that you may have to code differently to account for the differences between fixed/variable timestep, so if you're planning on making it fixed when you release, you'll need to make adjustments. See this article: http://rbwhitaker.wikidot.com/time-steps Is this a good indication that my code is ...


5

So the first thing I noticed was that when you do previousTouch = currentTouch; currentTouch.Clear(); this should also clear previous touch since List is a reference type. The second thing is that there is no space partitioning so your collision check currently runs in O(n^2) as best case runtime. The third thing is that it's weird that you calculate the ...


5

The first problem where the collisions were handled wrong, were solved with this solution posted by David. Instead of solving the two axis at the same time, the solution solves each axis individually. So, instead of sum the velocity at the position and handle the collisions, I sum each velocity and handle the direction: if (_velocity.Y != 0f) { Position ...


5

Finally I've found the solution to my problem. First I've created a new content pipeline by following this blog: http://community.monogame.net/t/tutorial-how-to-get-xnas-skinnedsample-working-with-monogame/7609 You will not need the special Blender plugin/extension to be able to export to XNA/Monogame, you can use the ordinary FBX exporter. Instead of ...


5

Truetype fonts are vector based. So you would have to trace the glyphs with a vector editor and then use a program like FontForge (which also is a vector editor) to build a font from that. That said, You do not need to use TTF fonts in MonoGame since it just renders the font to a texture at compile time. There are many bitmap font programs/examples ...


Only top voted, non community-wiki answers of a minimum length are eligible