public override void Update( GameTime gameTime ) { kbs = Keyboard.GetState(); bool c_up = false; bool c_left = false; bool c_down = false; bool c_right = false; foreach ( BlockManager.block bs in b.blocks ) { if ( bs.Rect.Intersects( new Rectangle( ( int ) Position.X, ( int ) Position.Y - 1, 32, 32 ) ) ) { c_up = true; break; } if ( bs.Rect.Intersects( new Rectangle( ( int ) Position.X, ( int ) Position.Y + 33, 32, 32 ) ) ) { c_down = true; break; } if ( bs.Rect.Intersects( new Rectangle( ( int ) Position.X - 1, ( int ) Position.Y, 32, 32 ) ) ){ c_left = true; break; } if ( bs.Rect.Intersects( new Rectangle( ( int ) Position.X + 33, ( int ) Position.Y, 32, 32 ) ) ){ c_right = true; break; } } if ( kbs.IsKeyUp( Keys.Up ) && !c_up ) { Position.Y++; } if ( kbs.IsKeyUp( Keys.Down ) && !c_down ) { Position.Y--; } if ( kbs.IsKeyUp( Keys.Right ) && !c_right ) { Position.X--; } if ( kbs.IsKeyUp( Keys.Left ) && !c_left ) { Position.X++; } base.Update( gameTime ); }