Hallo,
(Sorry wenn ich hier nicht richtig bin)
Ich hab in Problem und zwar versuch ich in XNA 3.1 mit dem Starter kit ein Jump ´n Run Spiel zu machen.Jetzt hab ich das Problem, das mir die Levels zu klein sind und ich so die Levels mal größer gemacht hab.
Wenn ich jetzt aber spiele und nach rechts laufe verschwindet mein Spieler.
Wie kann ich jetzt machen, dass sich die Kamera mitbewegt??
Danke im vorraus
Sven
OK tut mir leid
Also jetzt hab ich schoneinmal ne KAmera geschafft, aber wie kann ich jetzt hinkriegn, dass die sich mit dem spielr bewegt?
Mein Code der „Camera“ Klasse
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
namespace Platformer10
{
public class Camera
{
///
/// Position der Kamera.
///
public Vector2 Position
{
get { return position; }
set { position = value; }
}
private Vector2 position;
public void Update(GameTime gameTime)
{
float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
KeyboardState kbState = Keyboard.GetState();
// Kamera bewegen
if (kbState.IsKeyDown(Keys.Left))
{
position.X += 300.0f * elapsed;
}
if (kbState.IsKeyDown(Keys.Right))
{
position.X -= 300.0f * elapsed;
}
}
public Matrix GetMatrix()
{
return Matrix.CreateTranslation(new Vector3(position, 0));
}
}
}
Da es ein Jump´n Run spiel wird brauch ich nicht, dass sich die Kamera noch oben oder unten bewegt.
MFG Sven