public TileMap(Game game, int Seed = -1) { RND = new Random(); //position = new Vector2(-576); ///position = new Vector2(-128); position = new Vector2(); //tilesize = 48; tilesize = 16; //rows = 16; /*columns = 52;*/ rows = (int)Math.Ceiling(((-position.Y * 2) + game.stageBounds.bottom) / tilesize); columns = (int)Math.Ceiling(((-position.X * 2) + game.stageBounds.right) / tilesize); data = new TileData[columns, rows]; tiles = AnimationLoader.Get("images/land/brick"); cracks = AnimationLoader.Get("images/land/cracks"); this.game = game; buffer = new HTMLCanvasElement(); bg = buffer.GetContext(CanvasTypes.CanvasContext2DType.CanvasRenderingContext2D); if (Seed < 0) { this.Seed = RND.Next(); } else { this.Seed = Seed; } //Randomize(); Generate(); }
public ExitDoor(Game game) : base(game) { Ani = new Animation(AnimationLoader.Get("images/misc/door")); Ani.ImageSpeed = 0; Ani.SetImage(); RemovedOnLevelEnd = false; }
public Tile(Game game, int tile) : base(game) { this.tile = tile; Ani = new Animation(AnimationLoader.Get("images/land/brick")); Ani.CurrentFrame = tile; Ani.ImageSpeed = 0; }
public void ChangeAni(string animation, bool reset = false) { if (this.animation == animation) { return; } if (Ani == null) { Ani = new Animation(AnimationLoader.Get("images/enemies/mrghost" + animation)); } else { Ani.ChangeAnimation(AnimationLoader.Get("images/enemies/mrghost" + animation), reset); } this.animation = animation; }
public void ChangeAni(string animation, bool reset = false) { if (this.animation == animation) { return; } if (Ani == null) { Ani = new Animation(AnimationLoader.Get("images/cirno/" + animation)); } else { Ani.ChangeAnimation(AnimationLoader.Get("images/cirno/" + animation), reset); } if (this.animation != "stand") { turntime = 0; } this.animation = animation; }
public static void Finish() { AnimationLoader.Init(JSON); var LT = Document.GetElementById("loadtext").As <HTMLParagraphElement>(); LT.TextContent = ""; Document.Body.Style.Cursor = Cursor.Auto; Document.Title = GameName + " " + GameVersion + " by:RSGmaker"; //var R = new Renderer(); //Document.Body.AppendChild(R.view); Div = new HTMLDivElement(); HTMLCanvasElement Canv = new HTMLCanvasElement(); Canvas = Canv; TargetAspect = 0.75; Canv.Width = 1024; Canv.Height = (int)(Canv.Width * TargetAspect); ScreenBounds = new Rectangle(0, 0, Canv.Width, Canv.Height); Div.AppendChild(Canv); Document.Body.AppendChild(Div); //Document.Body.AppendChild(Canv); G = Canvas.GetContext(CanvasTypes.CanvasContext2DType.CanvasRenderingContext2D); G.ImageSmoothingEnabled = false; Canvas.Style.ImageRendering = ImageRendering.Pixelated; var gg = G; Script.Write("gg.webkitImageSmoothingEnabled = false"); Script.Write("gg.mozImageSmoothingEnabled = false"); KeyboardManager.Init(); CurrentView = new Game(); Action OnF = RAF; Script.Write("requestAnimationFrame(OnF);"); }
public CollectableItem(Game game, string itemName) : base(game) { Ani = new Animation(AnimationLoader.Get("images/items/" + itemName)); Ani.SetImage(); this.itemName = itemName; }
public static void Init(JSONArchive Archive) { __this = new AnimationLoader(); __this.Archive = Archive; }