Jump to content

  • Log In with Google      Sign In   
  • Create Account


povilaslt2

Member Since 14 Jul 2011
Offline Last Active Oct 26 2013 03:57 AM
-----

Topics I've Started

Two Arrays

13 August 2013 - 04:08 AM

Hey there, i have problem. I have 2 arrays and i want to get all possible combinations with these two arrays. For example: mUtrucu6. Can you help me?

                char[] charactersToTest =
                {
                    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
                    'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
                    'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E',
                    'F','G','H','I','J','K','L','M','N','O','P','Q','R',
                    'S','T','U','V','W','X','Y','Z',
                };
                char[] charactersToTest =
                {
                    '1','2','3','4','5','6','7','8','9','0'
                };

OpenGL 2D Camera

17 June 2013 - 09:43 AM

Hello, i have problem with my OpenGL 2D camera. I try to do when camera reaches max 'X' he locks and can't move further. I don't know how to accurately explain my problem.

 

Here's the code:

 

if ( (( player.x + cubes[LastBlock].x ) - CameraPos[0]) >= GetX( cubes ) + CameraPos[0])
                    CameraPos[0] = LastCameraPos[0];

 

GetX function finds highest 'X'.


Collision Problem

15 December 2012 - 01:13 PM

Hello, i thinking about complete tilemap game, but i have one problem. Problem is with collision, i can't make normal collision for my game, here's the code:

			for (int x = 0; x < tilemap.GetLength(1); x++)
			{
				for (int y = 0; y < tilemap.GetLength(0); y++)
				{
					if (tilemap[y, x] == -1) continue;
					if (man.Position.Y > (y * TextureHeight) - TextureHeight &amp;&amp; man.Position.Y < y * TextureHeight)
						tilesaty.Add(new Vector2(x * 40, y * 40));
				}
			}

			    foreach (Vector2 pos in tilesaty)
			    {
				    Rectangle rect = new Rectangle((int)pos.X, (int)pos.Y, TextureWidth, TextureHeight);
				    Rectangle rect2 = new Rectangle((int)man.Position.X, (int)man.Position.Y, (int)(man.mSpriteTexture.Width * man.Scale), (int)(man.mSpriteTexture.Height * man.Scale));
				    if (rect2.Right >= rect.Right &amp;&amp; rect2.Left < rect.Right)
					    man.Position.X -= 1;
			    }

Texture problem

02 November 2012 - 01:32 PM

Hey guys, i have a little problem. I have big spritesheet that i splited to 5 sprites. But when i change each sprite i'm having a big offset problem. I always getting not proportional positions. It means that position is not right.

for (int i = 0; i < AI.Count; i++)
		    {
			    bool a = cannonballs.Exists(ab => ab.Exploded == false && ab.rect.Intersects(AI[i].rect));
			    if (IsMouseInScreen() && a)
			    {
				    Sprite asas = cannonballs.Find(a2 => a2.Exploded == false && a2.rect.Intersects(AI[i].rect));
				    int lastwidth = AI[i].mSpriteTexture.Width;
				    int lastheight = AI[i].mSpriteTexture.Height;
				    AI[i].LoadContent(Content, "explosion");
				    AI[i].rect2.Width = AI[i].mSpriteTexture.Width - 342;
				    AI[i].rect2.Height = AI[i].mSpriteTexture.Height;
				    asas.Position.X += 198;
				    asas.Position.Y += 25;
				    AI[i].Exploded = true;
				    cannonballs.Remove(asas);
				    //AI.Remove(AI[i]);
			    }
		    }

Then i'm using timer to change sprites:


if (timer2.IsActive)
		    {
			    timer2.Update(gameTime);
		    }
		    else
		    {
			    if (timer2.CurrentDuration > 0)
			    {
				    if (IsMouseInScreen())
				    {
					    for (int i = 0; i < AI.Count; i++)
					    {
						    if (AI[i].Exploded)
						    {
							    if (AI[i].Explosion <= 5)
							    {
								    //string a = "Explosion/";
								    //string b = Convert.ToString(cannonballs[i].Explosion);
								    //a += b;
								    //cannonballs[i].LoadContent(Content, a);
								    AI[i].Explosion++;
								    AI[i].rect2.X += 90;
							    }
							    else
								    AI.Remove(AI[i]);
						    }
					    }
				    }
				    timer2.Start(0.00000001);
			    }
		    }

Here's my a little game:

Attached File  Žaidimas.zip   286.15KB   21 downloads

Sorry for my bad english ;/

XNA Frame animation problem

29 August 2012 - 11:34 AM

Hello how could i can solve that problem. When i run my game, and my sprite is doing an animation sprite moves. And I want that my sprite stand in place when animation is in action.

My Game: https://rapidshare.com/files/3393897454/WindowsGame1.rar

PARTNERS