Tag Info

New answers tagged

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


0

For: why "width = 2" looks like 80 pixels instead of 2? Pixels are gone in 3d space, but you still use them in your UI canvas. Your distances are in "units". How large something looks depends on if you put the camera 1 unit away from the object or 20, 100, etc.


0

http://www.rodedev.com/tutorials/gamephysics/ float jumpHeight = 4; //defining the jump height isn't needed. You need only determine the y velocity versus gravity. I suppose that jumpHeight could be the y velocity. You can use trigonometry to determine the jump velocity at a specific angel as shown on the link I provided. Grant you this isn't exactly in xna ...


0

Never done anything like that, but as an sugestion: what about the to draw the circle with gradient on each point between lighting parts? This will make the edges smooth, that might not be very much like a real lightning, but no ragged edges.


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


0

I Googled extensively yesterday and today screwing around with a similar issue. It turns out that, when using SpriteBatch with a custom effect that samples from textures, you must explicitly asign the textures to a register other than 0. effect.Parameters["WorkingTexture"].SetValue(WorkingTexture); SpriteBatch assigns this texture to register 0 ...


0

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


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



Top 50 recent answers are included