@cakebandit wrote:
I'm having heaps of trouble with a game I'm making, I cant seem to figure out how to link classes which are in another file. I dont want to shove everything onto one page. How do i achieve this, thanks.
` using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace Game1 { public class Game1 : Game { protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); charactermovement(); // TODO: Add your update logic here physics(); base.Update(gameTime); }` --------------------------------------------------------------- `using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace Game1 { class Movement { public void charactermovement() { if (Keyboard.GetState().IsKeyDown(Keys.Left)) { Player1characterPosition.X = Player1characterPosition.X - 5; } } } }`
Posts: 6
Participants: 4