Jump to content
  • Advertisement

surferkid993

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

100 Neutral

About surferkid993

  • Rank
    Newbie
  1. surferkid993

    Jumping Physics

    Hello, I am currently working on a 2D platformer. I am trying to make jumping easier to control. What I would like is something where is you hold the jump button down longer, you jump higher. Like most 2D platformers, like Mario, have. The problem with this is that I cant get it to look realistic. What I am doing now is I have a MAX_TIME that you can hold jump for. Then during this time period or until the jump button is released an upward acceleration is applied to the sprite. But this looks like it is floating up rather than jumping. Here is my code so far: JumpTime -= gameTime.ElapsedGameTime.Milliseconds; if (JumpTime <= 0) { EndJump(); } if (IsJumping) Velocity.Y += -8 * time; if (CurrentObjectState == ObjectState.Air) { Position += Velocity * time + physicsManager.GravityOverTwo * time * time; Velocity += physicsManager.Gravity * time; } else { Position += Velocity * time; } Does anyone have any advice on this? Or could someone point me to a good tutorial? Every tutorial I have found just has a fixed jump that isn't affected by how long the button is held down.
  2. surferkid993

    Problem With SetRenderTarget

    Bump. Still having trouble with this.
  3. surferkid993

    Problem With SetRenderTarget

    Thanks for the reply. Yeah, I know I moved refractionRenderTarget to the Draw method one to make sure that it wasn't the problem and two to make my code simpler and readable on here. That was my first thought too. For whatever reason it was clearing my Z-buffer for both render targets. However I tried not clearing the buffer. However player one's screen still didn't draw... What I have been doing to draw two screens is using Viewport. Each players camera has a viewport associated with it so that it can be set depending on what screen needs to be drawn. I have been doing a little bit of work with scissor rectangles. It seems they are automatically set when the viewport is changed, I think this is the big part of my problem. I tried just using scissor rectangles and it cuts the screen perfectly on windows however on Xbox it does not even seem to use the scissor rectangle and rather just draws over the whole screen. So, I think what is happening is, while my viewport is only the bottom half of the screen Xbox doesn't use the scissor rectangle to draw only on that part of the screen. I'm not sure of any of this though. It's mostly assumptions. But how do i fix it? I set ScissorTestEnable to true is there something else I have to do for Xbox?
  4. surferkid993

    Problem With SetRenderTarget

    Bump.
  5. I'm working in XNA 3.0 and trying to create a refraction map for water. It works great on Windows, but when I run it on my Xbox I am getting a problem. Its a split screen game so player 1 viewport is drawn first, then player 2 is drawn, but for some reason when player 2s screen is drawn it clears player 1 viewport. I am so confused as to why this works on windows and not on Xbox. Here is my code: refractionRenderTarget = new RenderTarget2D(device, Cam.GetViewport().Width, Cam.GetViewport().Height, 1, device.DisplayMode.Format); device.SetRenderTarget(0, refractionRenderTarget); //If I comment this out both viewports are drawn... device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1.0f, 0); DrawTerrain(Cam.getViewMatrix(), Cam); ((Game1)base.Game).DrawWorld(PlayerNum); device.SetRenderTarget(0, null); device.Viewport = Cam.GetViewport(); refractionMap = refractionRenderTarget.GetTexture();
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!