Fading in/out GameObject

Fading a Sprite is almost the-same as moving GameObject over time except that you modify its alpha instead of it’s position. The three most important stuff about fading an Object are Time.deltaTime, Mathf.Lerp/Color.Lerp and coroutine. You need to understand how these work together. Start coroutine, use Time.deltaTime to increment a variable. That variable is used … Read more

Create dynamic buttons in a grid layout – Create a magic square UI

You can use a TableLayoutPanel and add buttons to panel dynamically. If you don’t need interaction with buttons, you can add Label instead. Create square dynamically: public void CreateSquare(int size) { //Remove previously created controls and free resources foreach (Control item in this.Controls) { this.Controls.Remove(item); item.Dispose(); } //Create TableLayoutPanel var panel = new TableLayoutPanel(); panel.RowCount … Read more

Drawing Isometric game worlds

Update: Corrected map rendering algorithm, added more illustrations, changed formating. Perhaps the advantage for the “zig-zag” technique for mapping the tiles to the screen can be said that the tile’s x and y coordinates are on the vertical and horizontal axes. “Drawing in a diamond” approach: By drawing an isometric map using “drawing in a … Read more

Java Applet Game 2D Window Scrolling

This is a basic example of scrolling viewable area, where the virtual world is large then the view area. This basically maintains a number of parameters. It maintains the point where in the world the top/left of the view is and the players position within the world. These values are converted back to real world … Read more