public TopBarMenuComponent(MapSizePropertiesWindow mapMenuComponentIn, GridMapManager gridMapManagerIn, Game1 gameIn, Camera2d cameraIn) { this.mapMenuComponent = mapMenuComponentIn; this.game = gameIn; this.camera = cameraIn; this.gridMapManager = gridMapManagerIn; }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { //Clears the graphics device; updates the invisible renderer and player's strike box. GraphicsDevice.Clear(Color.Black); Camera2d cam = new Camera2d(); cam.Pos = new Vector2(CamX, CamY); p.RenderDim.X = (int)p.PlayerX + ((10 - p.RenderDim.Width) / 2); p.RenderDim.Y = (int)p.PlayerY + ((40 - p.RenderDim.Height) / 2); p.StrikeBox.X = (int)p.PlayerX + ((10 - p.StrikeBox.Width) / 2); p.StrikeBox.Y = (int)p.PlayerY + ((40 - p.StrikeBox.Height) / 2); //Begins the spriteBatch. spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam.get_transformation(GraphicsDevice)); //Draws map tiles in the TileList. foreach (Tile t in TileList) { if (t.Rect.Intersects(p.RenderDim)) { spriteBatch.Draw(t.Tex, new Vector2(t.X, t.Y), new Rectangle(0, 0, 25, 25), Color.White); } } //Draws the WorldObjects in the ObjectList. foreach (WorldObject w in ObjectList) { if (w.HitBox.Intersects(p.RenderDim)) { spriteBatch.Draw(w.Tex, new Vector2(w.X, w.Y), new Rectangle(0, 0, w.Tex.Width, w.Tex.Height), Color.White); } } //Draws each spawn in the SpawnList. foreach (Spawn s in SpawnList) { if (s.HitBox.Intersects(p.RenderDim) && !s.HitBox.Intersects(p.StrikeBox)) { spriteBatch.Draw(s.Npc.Tex, new Vector2(s.X, s.Y), new Rectangle(0, 0, s.Npc.Tex.Width, s.Npc.Tex.Height), Color.White); } } //Draws each invisible collider boundary in the BoundList. foreach (Tile t in BoundList) { spriteBatch.Draw(t.Tex, new Vector2(t.X, t.Y), t.Rect, Color.Black); } spriteBatch.Draw(p.PlayerHead, new Vector2(p.PlayerX, p.PlayerY - 10), new Rectangle(0, 0, p.PlayerHead.Width, p.PlayerBody.Height), Color.White); spriteBatch.Draw(p.PlayerBody, new Vector2(p.PlayerX, p.PlayerY), new Rectangle(0, 0, p.PlayerHead.Width, p.PlayerBody.Height), Color.White); spriteBatch.End(); base.Draw(gameTime); }
public Player(string Id, Inputs Inputs, Camera2d Camera, NetworkHandler network, bool remote) : base(Id) { this.Inputs = Inputs; animator = new PlayerAnimator(this); animator.mainCollider.Collision = new CollisionHandlerAggregation( new LogCollision() , new BlockCollisionHandler() , new FlagAsHit(this) ); animator.groundDetection.Collision = new FlagAsGrounded(this); Animation = animator; if (remote) { Update = CreateUpdatesByState(Inputs); } else { Update = new UpdateAggregation( CreateUpdatesByState(Inputs) , new BroadCastState(Camera, this, network) ); } }
protected override void Initialize() { cam = new Camera2d(); this.map = new Tilemap(40, 40, 40); this.textures = new Dictionary <string, Texture2D>(); this.p = new Player(); for (int i = 0; i < 10; i++) { for (int k = 0; k < 10; k++) { this.map.setTile(i, 1, k, new Stone()); } } for (int i = 0; i < 10; i++) { for (int k = 0; k < 10; k++) { this.map.setTile(i, 2, k, new Grass()); } } base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); IsMouseVisible = true; camera = new Camera2d(GraphicsDevice.Viewport); }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; this.IsMouseVisible = true;// permettre à la souris de s'afficher // graphics.IsFullScreen = true; // mettre en pleine écran m_cam = new Camera2d(); m_cam.Move(new Vector2(400, 200)); }
public Game() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; camera = new Camera2d(); //camera.Pos = new Vector2(500.0f, 200.0f); // camera.Zoom = 2.0f // Example of Zoom in // camera.Zoom = 0.5f // Example of Zoom out }
public Game1(NetworkService UdpWrapper, bool RuningOnAndroid = false) { this.RuningOnAndroid = RuningOnAndroid; graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; Camera = new Camera2d(); CameraUI = new Camera2d(); Camera.Zoom = 0.05f; CameraUI.Zoom = 1f; this.UdpWrapper = UdpWrapper; }
private GameWorld(Game game, Camera2d camref) { spriteBatch = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch)); Content = (ContentManager)game.Services.GetService(typeof(ContentManager)); gfxdevice = (GraphicsDevice)game.Services.GetService(typeof(GraphicsDevice)); this.Active = false; // start disabled cam = camref; //LoadObjects(); ItemStore.Instance.loadItems(Content.RootDirectory + @"\tables\", "itemtable.bin"); MonsterStore.Instance.loadMonster(Content.RootDirectory + @"\tables\", "monstertable.bin"); SkillStore.Instance.loadSkills(Content.RootDirectory + @"\tables\", "skilltable.bin"); }
//================================================================ //Constructors //================================================================ public BaseView(Game game, Vector2 position) { this.game = game; spriteBatch = new SpriteBatch(game.GraphicsDevice); camera = new Camera2d(game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height); camera.Position = new Vector2(camera.width / 2, camera.height / 2); childrens = new List <Widget>(); clickListener = new List <IOnClickListener>(); Position = position; background = new ViewBackground(position); background.Background(this, camera.width, camera.height); DrawBackground = true; }
//méthodes //update&draw public void update(MouseState mouse, KeyboardState keyboard, Camera2d cam) { Localplayer.update(mouse, keyboard, Walls, cam); foreach (Wall wall in Walls) { wall.update(mouse, keyboard); } if (mouse.LeftButton == ButtonState.Pressed && !clickdown) { Walls.Add(new Wall(mouse.X, mouse.Y, ressource.Arbre, 32)); clickdown = true; } if (mouse.LeftButton == ButtonState.Released) { clickdown = false; } }
public GameLoop(NetworkService UdpWrapper, Camera2d Camera, Camera2d CameraUI) { this.Camera = Camera; quadtree = new QuadTree(new Rectangle(-11000, -7000, 23000, 15000), 50, 5); var TouchWrapper = new TouchInputsWrapper(CameraUI); PlayerInputs = new MultipleInputSource(new KeyboardInputs(), new TouchControlInputs(TouchWrapper)); network = new NetworkHandler(UdpWrapper, PlayerInputs); var Player = new Player("player", PlayerInputs, Camera, network, false); GameObjects.Add(Player); var controller = new GameObject("Controller"); GameObjects.Add(controller); GameObjects.Add(new TouchControllerRenderer(CameraUI, PlayerInputs)); for (int i = -10; i < 10; i++) { GameObjects.Add(new Block { Position = new Vector2(1000 * i, 6000) }); GameObjects.Add(new Block { Position = new Vector2(1000 * i, -6000) }); GameObjects.Add(new Block { Position = new Vector2(1000 * 10, 1000 * i) }); GameObjects.Add(new Block { Position = new Vector2(1000 * -10, 1000 * i) }); } //TODO: move to other class CreateNetworkHandlers(Camera); }
public ContextMenuComponent(Game1 gameIn, GraphicsDevice gDeviceIn, Camera2d cameraIn) { this.graphicsDevice = gDeviceIn; this.camera = cameraIn; this.game = gameIn; }
private void CreateNetworkHandlers(Camera2d Camera) { network.MessageReceivedFromOtherClients += (ip, message) => { var p = GameObjects.FirstOrDefault(f => f.Id == ip) as Player; if (p == null) { network.PlayerConnected(ip, message); return; } p.Position = new Vector2(message.X, message.Y); p.Position.X = MathHelper.Lerp(p.Position.X, message.X, 0.01f); if (message.Left) { p.Inputs.Direction = DpadDirection.Left; } else if (message.Right) { p.Inputs.Direction = DpadDirection.Right; } else if (message.Up) { p.Inputs.Direction = DpadDirection.Up; } else if (message.Down) { p.Inputs.Direction = DpadDirection.Down; } else { p.Inputs.Direction = DpadDirection.None; } if (message.ButtonDown) { p.Inputs.Action = DpadAction.Jump; } else if (message.ButtonLeft) { p.Inputs.Action = DpadAction.Attack; } else { p.Inputs.Action = DpadAction.None; } }; //TODO: atualmente nenhum player é identificado como server... network.MessageReceivedFromServer += (ip, message) => { //var p = GameObjects.FirstOrDefault(f => f.Id == ip) as NetworkPlayer; //p.Position.Current = new Point(message.X, message.Y); //p.NetworkInputs.IsPressingLeft = message.Left; //p.NetworkInputs.IsPressingRight = message.Right; //p.NetworkInputs.IsPressingJump = message.A; }; network.PlayerConnected += (ip, message) => { if (GameObjects.Any(f => f.Id == ip)) { return; } var netPlayer = new Player(ip, new NetworkInputs(), Camera, network, true); netPlayer.Position = new Vector2(message.X, message.Y); GameObjects.Add(netPlayer); }; network.PlayerDisconnected += (ip) => { var obj = GameObjects.FirstOrDefault(f => f.Id == ip); if (obj != null) { GameObjects.Remove(obj); } }; }
//update&draw public void update(MouseState mouse, KeyboardState keyboard, List<Wall> walls, Camera2d cam) { tmpbox.Width = this.hitbox2.Width; tmpbox.Height = this.hitbox2.Height; if (keyboard.IsKeyDown(Keys.Up)) { bool collide = false; //tmpbox = new Rectangle(this.hitbox2.X, this.hitbox2.Y + this.Speed, this.hitbox2.Width, this.hitbox2.Height); tmpbox.X = this.hitbox2.X; tmpbox.Y = this.hitbox2.Y - this.Speed; foreach (Wall wall in walls) { wallreducebox.X = wall.hitbox.X + (int)(wall.hitbox.Width * 0.3f); wallreducebox.Y = wall.hitbox.Y + (int)(wall.hitbox.Height * 0.3f); wallreducebox.Width = (int)(wall.hitbox.Width * 0.2f); wallreducebox.Height = (int)(wall.hitbox.Height * 0.2f); if (tmpbox.Intersects(wallreducebox)) { collide = true; break; } } if (!collide) this.hitbox2.Y -= this.Speed; this.direction = direction.Up; this.animate(); } else if (keyboard.IsKeyDown(Keys.Down))/* je met un else if pour éviter que le perso bouge en diagonale*/ { bool collide = false; //tmpbox = new Rectangle(this.hitbox2.X, this.hitbox2.Y - this.Speed, this.hitbox2.Width, this.hitbox2.Height); tmpbox.X = this.hitbox2.X; tmpbox.Y = this.hitbox2.Y + this.Speed; foreach (Wall wall in walls) { wallreducebox.X = wall.hitbox.X + (int)(wall.hitbox.Width * 0.3f); wallreducebox.Y = wall.hitbox.Y + (int)(wall.hitbox.Height * 0.3f); wallreducebox.Width = (int)(wall.hitbox.Width * 0.2f); wallreducebox.Height = (int)(wall.hitbox.Height * 0.2f); if (tmpbox.Intersects(wallreducebox)) { collide = true; break; } } if (!collide) this.hitbox2.Y += this.Speed; this.direction = direction.Down; this.animate(); } else if (keyboard.IsKeyDown(Keys.Left))/* je met un else if pour éviter que le perso bouge en diagonale*/ { bool collide = false; //tmpbox = new Rectangle(this.hitbox2.X - this.Speed, this.hitbox2.Y, this.hitbox2.Width, this.hitbox2.Height); tmpbox.X = this.hitbox2.X - this.Speed; tmpbox.Y = this.hitbox2.Y; foreach (Wall wall in walls) { wallreducebox.X = wall.hitbox.X + (int)(wall.hitbox.Width * 0.3f); wallreducebox.Y = wall.hitbox.Y + (int)(wall.hitbox.Height * 0.3f); wallreducebox.Width = (int)(wall.hitbox.Width * 0.2f); wallreducebox.Height = (int)(wall.hitbox.Height * 0.2f); if (tmpbox.Intersects(wallreducebox)) { collide = true; break; } } if (!collide) this.hitbox2.X -= this.Speed; this.direction = direction.Left; this.animate(); } else if (keyboard.IsKeyDown(Keys.Right))/* je met un else if pour éviter que le perso bouge en diagonale*/ { bool collide = false; //tmpbox = new Rectangle(this.hitbox2.X + this.Speed, this.hitbox2.Y, this.hitbox2.Width, this.hitbox2.Height); tmpbox.X = this.hitbox2.X + this.Speed; tmpbox.Y = this.hitbox2.Y; foreach (Wall wall in walls) { wallreducebox.X = wall.hitbox.X + (int)(wall.hitbox.Width * 0.3f); wallreducebox.Y = wall.hitbox.Y + (int)(wall.hitbox.Height * 0.3f); wallreducebox.Width = (int)(wall.hitbox.Width * 0.2f); wallreducebox.Height = (int)(wall.hitbox.Height * 0.2f); if (tmpbox.Intersects(wallreducebox)) { collide = true; break; } } if (!collide) this.hitbox2.X += this.Speed; this.direction = direction.Right; this.animate(); } cam._pos.X = this.hitbox2.X; cam._pos.Y = this.hitbox2.Y; if (keyboard.IsKeyUp(Keys.Up) && keyboard.IsKeyUp(Keys.Down) && keyboard.IsKeyUp(Keys.Left) && keyboard.IsKeyUp(Keys.Right)) // permer de mettre le bon sprite à l'arrêt du perso { this.framecolumn = 2; this.timer = 0; } switch (this.direction) { case direction.Up: this.frameline = 2; this.effect = SpriteEffects.None; break; case direction.Down: this.frameline = 1; this.effect = SpriteEffects.None; break; case direction.Left: this.frameline = 3; this.effect = SpriteEffects.None; break; case direction.Right: this.frameline = 3; this.effect = SpriteEffects.FlipHorizontally; // fait faire un tour au sprite pour le mettre de l'autre sens break; /* permet de mettre les sprites de telle facon que les sprites bougent dans les bonnes directions*/ } }
public Unit(Camera2d camera) { this.camera = camera; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 600; graphics.SynchronizeWithVerticalRetrace = false; graphics.ApplyChanges(); assets = new Dictionary<string, Texture2D>(); gameObjects = new List<GameObject>(); phySim = new PhysicsSimulator(new Vector2(0, -200)); var ballObject = GameObjectFactory.CreateCircleGameObject(phySim, "ball", 22f, 1); ballObject.Center = new Vector2(250, 400); ballObject.Geom.FrictionCoefficient = 0; FixedAngleJoint asdf = new FixedAngleJoint(ballObject.Body, 0); phySim.Add(asdf); player = ballObject; gameObjects.Add(ballObject); var platformObject = GameObjectFactory.CreateRectangleGameObject(phySim, "platform", 256, 64, 6); platformObject.IsStatic = true; platformObject.Center = new Vector2(250, 300); platformObject.Rotation = MathHelper.ToRadians(-30f); var platformObject2 = GameObjectFactory.CreateRectangleGameObject(phySim, "platform", 256, 64, 6); platformObject2.Center = new Vector2(5, 150); platformObject2.Rotation = MathHelper.ToRadians(90f); platformObject2.Geom.FrictionCoefficient = 10; var floorObject = GameObjectFactory.CreateRectangleGameObject(phySim, "floor", 1024, 12, 1); floorObject.Center = new Vector2(500, 0); floorObject.IsStatic = true; floorObject.Geom.FrictionCoefficient = 1; camera = new Camera2d(new Vector2(0, 0), new Vector2(800, 600), new Vector2(100, 100)); gameObjects.Add(floorObject); gameObjects.Add(platformObject2); gameObjects.Add(platformObject); base.Initialize(); }
public Fighter(bool playerControlled, Vector2 position, Camera2d camera) : base(camera) { this.playerControlled = playerControlled; this.position = position; // Definicja animacji postaci this.animation = new Animation(2, 5, Direction.Left); AnimationFrame mini1 = new AnimationFrame(@"Game\mini1", new Rectangle(0, 0, 200, 200), new Rectangle(0, 0, 40, 40)); mini1.origin = new Vector2(100, 180); AnimationFrame mini2 = new AnimationFrame(@"Game\mini2", new Rectangle(0, 0, 200, 200), new Rectangle(0, 0, 40, 40)); mini2.origin = new Vector2(100, 180); this.animation.framesLeft.Add(mini1); this.animation.framesLeft.Add(mini2); this.animation.framesRight.Add(mini1); this.animation.framesRight.Add(mini2); this.animation.framesUp.Add(mini1); this.animation.framesUp.Add(mini2); this.animation.framesDown.Add(mini1); this.animation.framesDown.Add(mini2); this.animationDeath = new Animation(20, 15, Direction.Left); AnimationFrame frame; for (int i = 1; i <= 10; i++) { frame = new AnimationFrame(@"Game\AnimationDeath\mini1_klatka" + i.ToString(), new Rectangle(0, 0, 200, 200), new Rectangle(0, 0, 40, 40)); frame.origin = new Vector2(100, 180); if (i == 10) { for (int j = 0; j < 11; j++) { this.animationDeath.framesLeft.Add(frame); this.animationDeath.framesRight.Add(frame); this.animationDeath.framesUp.Add(frame); this.animationDeath.framesDown.Add(frame); } } else { this.animationDeath.framesLeft.Add(frame); this.animationDeath.framesRight.Add(frame); this.animationDeath.framesUp.Add(frame); this.animationDeath.framesDown.Add(frame); } } List <Vector2> points = new List <Vector2>(); points.Add(new Vector2(-BoundariesSize, 0)); points.Add(new Vector2(0, -BoundariesSize)); points.Add(new Vector2(BoundariesSize, 0)); points.Add(new Vector2(0, BoundariesSize)); this.boundaries = Boundaries.CreateFromPoints(points); this.health = 8; this.isActive = true; this.speed = 0.75f; this.timeLastShot = new TimeSpan(); this.destination = new Vector2(position.X, position.Y); }
public Enemy(Vector2 position, Camera2d camera) : base(camera) { this.position = position; // Definicja animacji postaci this.animation = new Animation(2, 5, Direction.Left); AnimationFrame eiti1 = new AnimationFrame(@"Game\eiti1", new Rectangle(0, 0, 200, 200), new Rectangle(0, 0, 40, 40)); eiti1.origin = new Vector2(100, 180); AnimationFrame eiti2 = new AnimationFrame(@"Game\eiti2", new Rectangle(0, 0, 200, 200), new Rectangle(0, 0, 40, 40)); eiti2.origin = new Vector2(100, 180); this.animation.framesLeft.Add(eiti1); this.animation.framesLeft.Add(eiti2); this.animation.framesRight.Add(eiti1); this.animation.framesRight.Add(eiti2); this.animation.framesUp.Add(eiti1); this.animation.framesUp.Add(eiti2); this.animation.framesDown.Add(eiti1); this.animation.framesDown.Add(eiti2); this.animationDeath = new Animation(20, 15, Direction.Left); AnimationFrame frame; for (int i = 1; i <= 10; i++) { frame = new AnimationFrame(@"Game\AnimationDeath\eiti1_klatka" + i.ToString(), new Rectangle(0, 0, 200, 200), new Rectangle(0, 0, 40, 40)); frame.origin = new Vector2(100, 180); if (i == 10) { for (int j = 0; j < 11; j++) { this.animationDeath.framesLeft.Add(frame); this.animationDeath.framesRight.Add(frame); this.animationDeath.framesUp.Add(frame); this.animationDeath.framesDown.Add(frame); } } else { this.animationDeath.framesLeft.Add(frame); this.animationDeath.framesRight.Add(frame); this.animationDeath.framesUp.Add(frame); this.animationDeath.framesDown.Add(frame); } } List <Vector2> points = new List <Vector2>(); points.Add(new Vector2(-BoundariesSize, 0)); points.Add(new Vector2(0, -BoundariesSize)); points.Add(new Vector2(BoundariesSize, 0)); points.Add(new Vector2(0, BoundariesSize)); this.boundaries = Boundaries.CreateFromPoints(points); this.health = 6; this.speed = 0.55f; this.timeLastShot = new TimeSpan(); }
public static GameWorld CreateInstance(Game game, Camera2d camref) { lock (_mutex) // now I can claim some form of thread safety... { if (mInstance == null) { mInstance = new GameWorld(game, camref); } } return mInstance; }
public TAGame(MainGame game) : base(game) { homeworks = new Queue <HomeworkSet>(); homeworks.Enqueue(new HomeworkSet(new ProblemSet[] { new GeographySet1() } , MediaManager.textures["geo results"])); homeworks.Enqueue(new HomeworkSet(new ProblemSet[] { new ChemistrySet3(), new ChemistrySet2(), new ChemistrySet1() } , MediaManager.textures["chem results"])); homeworks.Enqueue(new HomeworkSet(new ProblemSet[] { new GeographySet2() } , MediaManager.textures["geo results"])); homeworks.Enqueue(new HomeworkSet(new ProblemSet[] { new ChemistrySet7(), new ChemistrySet6(), new ChemistrySet5(), new ChemistrySet4() } , MediaManager.textures["chem results"])); homeworks.Enqueue(new HomeworkSet(new ProblemSet[] { new GeographySet3() } , MediaManager.textures["geo results"])); homeworks.Enqueue(new HomeworkSet(new ProblemSet[] { new ChemistrySet11(), new ChemistrySet10(), new ChemistrySet9(), new ChemistrySet8() } , MediaManager.textures["geo results"])); homeworks.Enqueue(new HomeworkSet(new ProblemSet[] { new GeographySet4() } , MediaManager.textures["chem results"])); homeworks.Enqueue(new HomeworkSet(new ProblemSet[] { new ChemistrySet15(), new ChemistrySet14(), new ChemistrySet13(), new ChemistrySet12() } , MediaManager.textures["geo results"])); homeworks.Enqueue(new HomeworkSet(new ProblemSet[] { new GeographySet5() } , MediaManager.textures["chem results"])); homeworks.Enqueue(new HomeworkSet(new ProblemSet[] { new ChemistrySet19(), new ChemistrySet18(), new ChemistrySet17(), new ChemistrySet16() } , MediaManager.textures["geo results"])); numPapers = -1; //create camera views zoomedOut = new Camera2d(); zoomedOut.Zoom = 0.533333333f; // = 1200/2250 zoomedOut.Pos = new Vector2(1125, 750); zoomedIn = new Camera2d(); zoomedIn.Zoom = 1.0f; // = 1200/1200 zoomedIn.Pos = new Vector2(1350, 975); //create paperstacks graded = new HomeworkStack(MediaManager.textures["paper"], new Vector2(750, 600)); ungraded = new HomeworkStack(MediaManager.textures["ungraded stack"], new Vector2(0, 570)); pen = new GradingStamp(MediaManager.textures["pen_incorrect"], new Vector2(1500, 750)); cheater = new GradingStamp(MediaManager.textures["pen_cheater"], new Vector2(1500, 1050)); currentScore = new Score(); totalScore = new Score(); //create flashing party Texture2D[] animation = new Texture2D[37]; for (int i = 0; i < 37; i++) { animation[i] = MediaManager.content.Load <Texture2D>(String.Format("content/partay/implied_partay0_{0:00000}", i)); } AnimatedObject party = new AnimatedObject(animation, new Vector2(0, 0), 24); drawableObjects.Add(party); drawableObjects.Add(ungraded); drawableObjects.Add(graded); drawableObjects.Add(pen); clickableObjects.Add(ungraded); clickableObjects.Add(graded); clickableObjects.Add(pen); updateableObjects.Add(party); }
public const float DEGREE_270 = 0; //4.713f; public TouchControllerRenderer(Camera2d camera, Inputs inputs) : base("Touch Controller Renderer") { Animation = new AnimationGroup( new TogglableAnimation(() => inputs.Direction == DpadDirection.Up, new Animation( new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON_TOP_X + (BUTTON_WIDTH / 2), BUTTON_TOP_Y + (BUTTON_HEIGHT / 2)), RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2) }) , new Animation( new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON_TOP_X + (BUTTON_WIDTH / 2) + ANIMATION_BONUS, BUTTON_TOP_Y + (BUTTON_HEIGHT / 2) + ANIMATION_BONUS), Color = Color.DarkGray, RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2) }) ), new TogglableAnimation(() => inputs.Direction == DpadDirection.Down , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON_BOT_X + (BUTTON_WIDTH / 2), BUTTON_BOT_Y + (BUTTON_HEIGHT / 2)), RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_180 }) , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON_BOT_X + (BUTTON_WIDTH / 2) + ANIMATION_BONUS, BUTTON_BOT_Y + (BUTTON_HEIGHT / 2) + ANIMATION_BONUS), Color = Color.DarkGray, RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_180 })), new TogglableAnimation(() => inputs.Direction == DpadDirection.Left , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON_LEFT_X + (BUTTON_WIDTH / 2), BUTTON_LEFT_Y + (BUTTON_HEIGHT / 2)), RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_270 }) , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON_LEFT_X + (BUTTON_WIDTH / 2) + ANIMATION_BONUS, BUTTON_LEFT_Y + (BUTTON_HEIGHT / 2) + ANIMATION_BONUS), Color = Color.DarkGray, RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_270 })), new TogglableAnimation(() => inputs.Direction == DpadDirection.Right , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON_RIGHT_X + (BUTTON_WIDTH / 2), BUTTON_RIGHT_Y + (BUTTON_HEIGHT / 2)), RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_90 }) , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON_RIGHT_X + (BUTTON_WIDTH / 2) + ANIMATION_BONUS, BUTTON_RIGHT_Y + (BUTTON_HEIGHT / 2) + ANIMATION_BONUS), Color = Color.DarkGray, RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_90 })), new TogglableAnimation(() => inputs.Direction == DpadDirection.Up, new Animation( new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON2_TOP_X + (BUTTON_WIDTH / 2), BUTTON2_TOP_Y + (BUTTON_HEIGHT / 2)), RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2) }) , new Animation( new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON2_TOP_X + (BUTTON_WIDTH / 2), BUTTON2_TOP_Y + (BUTTON_HEIGHT / 2)), Color = Color.DarkGray, RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2) }) ), new TogglableAnimation(() => inputs.Action == DpadAction.Jump , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON2_BOT_X + (BUTTON_WIDTH / 2), BUTTON2_BOT_Y + (BUTTON_HEIGHT / 2)), RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_180 }) , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON2_BOT_X + (BUTTON_WIDTH / 2) + ANIMATION_BONUS, BUTTON2_BOT_Y + (BUTTON_HEIGHT / 2) + ANIMATION_BONUS), Color = Color.DarkGray, RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_180 })), new TogglableAnimation(() => inputs.Direction == DpadDirection.Left , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON2_LEFT_X + (BUTTON_WIDTH / 2), BUTTON2_LEFT_Y + (BUTTON_HEIGHT / 2)), RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_270 }) , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON2_LEFT_X + (BUTTON_WIDTH / 2), BUTTON2_LEFT_Y + (BUTTON_HEIGHT / 2)), Color = Color.DarkGray, RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_270 })), new TogglableAnimation(() => inputs.Direction == DpadDirection.Right , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON2_RIGHT_X + (BUTTON_WIDTH / 2), BUTTON2_RIGHT_Y + (BUTTON_HEIGHT / 2)), RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_90 }) , new Animation(new AnimationFrame(camera, "dpad", BUTTON_WIDTH, BUTTON_HEIGHT) { Offset = new Vector2(BUTTON2_RIGHT_X + (BUTTON_WIDTH / 2), BUTTON2_RIGHT_Y + (BUTTON_HEIGHT / 2)), Color = Color.DarkGray, RotationAnchor = new Vector2(BUTTON_WIDTH / 2, BUTTON_HEIGHT / 2), Rotation = DEGREE_90 })) ) { RenderOnUiLayer = true }; }