Tag Info

Hot answers tagged

3

What your algorithm doesn't account for is if the ball's vertical speed is less than your paddle's speed (in your specific scenario, 3). Consider the following example: The ball is moving perfectly horizontally (y speed is zero) The AI paddle uses a vertical speed of 3 units as in your exact scenario The paddle's y position is 10 The ball's y position is ...


1

Notice that you are launching a sound effect while the player is dead, not when the player died. The obvious solution would be to call your soundEffect.Play here: if (vehicles[count].bbox.Intersects(playerSprites[lives].bbox)){ playerSprites[lives].isDead = true; deathSound.Play(); //and also disable further intersection tests with player bbox to ...


1

This is because the sprite batch hijacks the graphics device's states when you use it. You need to cache them before using the sprite batch and then restore them afterwards. (Or you can set them directly afterwards without caching if you know the ones you want to use.) // cache device states var blendState = GraphicsDevice.BlendState; var depthStencilState ...


1

So , as already was sad there are no pixels in 3D spcae at all. There are usints that dont have any relations with 2D pixels. Pixel are also units, but they have fixed size couse screen have have fixed resolution. For example if your monitor is 12 inches in width and 9 inches in height and resolutins is set to 800x600 one pixel will have real size ...


1

Like dustin said, the size of a 3d object isnt measured in pixels. But if you wish to scale it, change "world = Matrix.CreateTranslation(10.0f, 10.0f, 0.0f);" to "world = Matrix.CreateScale(2) * Matrix.CreateTranslation(10.0f, 10.0f, 0.0f);". Notice that I put the scale factor matrix BEFORE the translation. Otherwise, the translation would also get scaled. ...


1

If you are looking to use a Matrix as a camera and to scale and rotate the scene then spriteBatch.Begin() is indeed what you are looking for. Now I know it looks like a lot of parameters but you can actually assign most of them null values. For example: spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, YourMatrix); You can find out ...


1

If you simply want to scale a sprite you can do spriteBatch.Begin(); spriteBatch.Draw(texture, position, null, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f); spriteBatch.End(); or spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, Matrix.CreateScale(0.5f)); spriteBatch.Draw(texture, position, Color.White); ...


1

Having the exactly same issue here - the following code snipped works perfectly fine: private void DoRenderSkybox (GameTime Time) { this.Device.SetRenderTarget(this.GridTexture); this.Device.SetRenderTarget(null); // compute a temporary transformation matrix containing // the combined world and projection transfromation Matrix ...



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