monogame

Could not load asset as a non-content file

若如初见. 提交于 2019-12-12 11:15:51
问题 Why does this keep happening? I research it and know of them helps. Codes: using System; using System.Collections.Generic; using System.Linq; using System.Net.Mail; using System.Security.Policy; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace Pratice { public class CharacterClass { public Texture2D texture; public Vector2 position, velocity; public Rectangle

Could not load content1.png asset as non content file

白昼怎懂夜的黑 提交于 2019-12-12 08:32:15
问题 When trying to import an image into my 'game' I get a error message. The one displayed in the title. it is called content1.png and is in the Content folder. I have public override void LoadContent() { base.LoadContent(); path = "Content/content1.png"; splash1 = content.Load<Texture2D>(path); } and it doesn't load it. I have no idea what to do here. 回答1: It's seems like the content.Load<Texture2D> method tries to open the file from your File-System and it is not founded there, do the following

OpenGL or DirectX Monogame Template for porting to Windows 8 Phone?

。_饼干妹妹 提交于 2019-12-12 06:48:41
问题 Basically I'm wanting to create a game with MonoGame that works on both Windows Desktop and Windows 8 Phones and I was wondering which MonoGame template for the Windows Desktop Version would be better, the OpenGL template or the DirectX one? I've heard that Windows 8 Phone doesn't support OpenGL so I'm essentially wanting to know which template would allow me to simply copy and paste most of the code to the Windows Phone Project and have it still work with only minor alterations. 回答1: The

An unhandled exception of type 'System.ArgumentNullException' occurred in MonoGame.Framework.dll

雨燕双飞 提交于 2019-12-11 20:14:45
问题 I'm currently trying to create a simple game using MonoGame. The problem I'm currently facing is that sometime(like half of the time) my code runs without problem. But there's time when it throw me this exception: An unhandled exception of type 'System.ArgumentNullException' occurred in MonoGame.Framework.dll Additional information: Value cannot be null. So my question here is how do approach this kind of problems as it doesn't happen all the time? I've tried cleaning my solution. But

MonoGame - Have an object circle around a point

末鹿安然 提交于 2019-12-11 18:49:55
问题 I have an object with a Vector2 Position , and a cursor with Vector2 Position . When I hold a certain key, I want the object to circle around the object, but I'm having trouble calculating the correct coordinates. I've managed to make the object circle around the cursor (but it's not going in a perfect circle, but more of a spiral) with this code: Vector2 diff= Vector2.Normalize(cursor.Location - this.Location); float angle = (float)Math.Atan2(diff.Y, diff.X) + (float)(90 * (Math.PI / 180));

2D Water Bump Mapping - Monogame

别来无恙 提交于 2019-12-11 18:45:55
问题 Thanks for taking the time to check out my issue. I am working on improving the ocean in my first attempt at a game. I have decided on a using a bump map against my ocean tiles to add a little texture to the water. To do this, I draw my water tiles to a renderTarget and then apply a pixel shader while drawing the render target to the backbuffer. The problem I am having is that the pixel shader seems to offset or displace the position of render target that is drawn. Observe these two photos:

360 FOV depth buffer by topology and 2D shadows

我的未来我决定 提交于 2019-12-11 18:31:35
问题 in prev question https://stackoverflow.com/questions/32085542/how-to-define-a-matrix-to-transform-2d-plane-into-perspective-360%C2%B0-fov i've asked for a matrix solution for 2D shadows, where depth to the nearest caster is found by all around light. Well, seems its impossible to make such a matrix as i expected. So i've found another method (still does'nt work as expected but very near), and this is the question. First let me explain topology and behaviour: I've defined a background rect

MonoGame - BlendState - 2D SpriteBatch

允我心安 提交于 2019-12-11 18:09:09
问题 I need SpriteBatch to render images how I would expect in WPF or a normal UIKit app: partially transparent PNGs render on top of one another, as you would expect I have an alpha I can modify, preferably something like using Color.White and modifying the A value. Closest has been using BlendState.NonPremultiplied , but I get weird lines where partially transparent PNGs overlap on one another. I was having similar issues on Windows (see here), but fixed it by changing the Premultiplied setting

Move sprite like in Pokémon

有些话、适合烂在心里 提交于 2019-12-11 12:08:45
问题 I have a game, where I want my characters to move in my field square by square, like in Pokémon. With the code I have, it is moving square by square just it skips on every key hit about 4-5 squares. And just jumps around. Can someone help me to get my code work in a similar manner like Pokémon? The code I have is as follows. public class Map { private Map() { Position = new Vector2(0, 0); } public string Data { get; set; } public string[][] MapData { get; set; } public ContentManager Content

Run Android Activity from c# code(I use Xamarin with Monogame)

谁说胖子不能爱 提交于 2019-12-11 10:47:44
问题 I use Xamarin with Monogame and i need run android activity from c# code. I try do this: public class Test : Activity { public void Start() { StartActivity(typeof(MyActivity)); } } } Then from Update() i calling Start(). protected override void Update(GameTime gameTime) { ... Test test = new Test(); test.Start(); ... } But i have error. Help me, please 回答1: An existing Activity instance has a bit of work that goes on behind the scenes when it's constructed; activities started through the