public CustomPlatform(Core engine) : base(engine) { RegisterGrid(new PlatformerGrid((engine.ScreenWith() * 2) / 32, engine.ScreenHeight() / 32, 32)); Stand = new SpriteSheet("stand", 32, 32, 1, 5, 5, Test.Properties.Resources.charachter); RunLeft = new SpriteSheet("run_left", 32, 32, 15, 6, 9, Test.Properties.Resources.charachter); RunRight = new SpriteSheet("run_right", 32, 32, 15, 0, 3, Test.Properties.Resources.charachter); JumpLeft = new SpriteSheet("jump_left", 32, 32, 5, 10, 10, Test.Properties.Resources.charachter); JumpRight = new SpriteSheet("jump_right", 32, 32, 5, 4, 4, Test.Properties.Resources.charachter); Character = new PlatformCharacter(new System.Drawing.PointF(PLAYER_SPAWN_X, PLAYER_SPAWN_Y), Stand); Character.Animations.RegisterAnimation(Stand); Character.Animations.RegisterAnimation(RunLeft); Character.Animations.RegisterAnimation(RunRight); Character.Animations.RegisterAnimation(JumpLeft); Character.Animations.RegisterAnimation(JumpRight); Grid.addNode(Character); Character.SetAnimation("stand"); Jump = new Audio(Engine.Ressources("Jump.wav")); }
public CustomPlatform(Engine.Base.Engine engine) : base(engine) { //Generate empty Grid (Platform) RegisterGrid(new PlatformerGrid((engine.ScreenWidth() * 2) / 32, (engine.ScreenHeight() * 2) / 32, 32)); //Init the character animations and frames Stand = new SpriteSheet("stand", 32, 32, 1, 5, 5, Test.Properties.Resources.charachter); RunLeft = new SpriteSheet("run_left", 32, 32, 15, 6, 9, Test.Properties.Resources.charachter); RunRight = new SpriteSheet("run_right", 32, 32, 15, 0, 3, Test.Properties.Resources.charachter); JumpLeft = new SpriteSheet("jump_left", 32, 32, 5, 10, 10, Test.Properties.Resources.charachter); JumpRight = new SpriteSheet("jump_right", 32, 32, 5, 4, 4, Test.Properties.Resources.charachter); //Set the spawn position to 200 PLAYER_SPAWN_Y = 600; //Create character and set the animation Character = new PlatformCharacter(new System.Drawing.PointF(PLAYER_SPAWN_X, PLAYER_SPAWN_Y), Stand); Character.Animations.RegisterAnimation(Stand); Character.Animations.RegisterAnimation(RunLeft); Character.Animations.RegisterAnimation(RunRight); Character.Animations.RegisterAnimation(JumpLeft); Character.Animations.RegisterAnimation(JumpRight); //Add character to the platform Grid.addNode(Character); //Default animation Character.SetAnimation("stand"); //Another character to use a ref Another = new PlatformerNode(new System.Drawing.PointF(20 * 32, 20), Stand); Another.Animations.RegisterAnimation(Stand); Another.Animations.RegisterAnimation(RunLeft); Another.Animations.RegisterAnimation(RunRight); Another.Animations.RegisterAnimation(JumpLeft); Another.Animations.RegisterAnimation(JumpRight); Grid.addNode(Another); Another.SetAnimation("stand"); //Hide the Grid ShowGrid = false; Jump = new Audio(Engine.Ressources("Jump.wav")); }