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 are no conversions of XNA to the android platform without using either MonoGame or EXNA. You will need to rewrite your game including all the rendering logic in either C# using Xamarin.Android or a complete rewrite in Java.


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

Quite the opposite. MonoGame stands to be the perfect replacement for existing XNA developers. It doesn't do everything that XNA did yet but there's no good reason why it can't. Coupled with the fact that it sports many more platforms and it's already being used in many reputable games I'm confident it will be great for some time to come. Edit: I wrote this ...


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

Not unless you are using features that the target platform does not support. If you want to use Effect files from a previous XNA project or an XNA sample, you'll need to process them with the MonoGame Effect processor to compile them for that specific platform. Some of these use OpenGL rather than DirectX as their graphics API, so the Effect file from XNA ...


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

If you look inside each project file on github you can see the constants defined for each platform. I've extracted them here: Android - TRACE;ANDROID;GLES;OPENGL Linux - LINUX;OPENGL MacOS - MONOMAC;OPENGL Ouya - TRACE;ANDROID;GLES;OPENGL;OUYA PSMobile - DEBUG;PSM Windows - DEBUG;TRACE;WINDOWS;DIRECTX;WINDOWS_MEDIA_SESSION Windows8 - TRACE;NETFX_CORE;WINRT;...


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

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

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 ...


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